Accept EMV & Contactless Payments with Stripe

The recipe is targeted at merchants and merchant service providers who want to integrate a card reader into their app and accept EMV & contactless payments with a Stripe account. It also covers how Stripe Connect can be used together with payworks.

Merchant Setup

Head to the Test Gateway Manager to create a new Merchant with a Stripe Processing Path and make sure to enter your Stripe Test Secret Key. Also create a merchantSecretKey for the new Merchant.

Perform a Payment with Stripe

After integrating the Pay Button make sure to switch to a real card reader and use the merchantIdentifier and merchantSecretKey from the merchant you have just created.

You can then start a payment and also send additional parameters towards Stripe like a statment descriptor or metadata.

On iOS:

MPTransactionParameters *parameters =
[MPTransactionParameters chargeWithAmount:[NSDecimalNumber decimalNumberWithString:@"10.00"]
								 currency:MPCurrencyGBP
								optionals:^(id optionals)
	{
		// This subject (max. 128 characters with spaces) will appear as the Description in the Stripe Dashboard
		optionals.subject = @"Bouquet of Flowers";
	
		// Specify a Statement Descriptor
		optionals.statementDescriptor = @"Bouquet";
	
		// Specify up to 20 key-value pairs (See https://stripe.com/docs/api#metadata)
		optionals.metadata = @{
							   @"Source" : @"POS",
							   @"Clerk Name" : @"John Appleseed"
							   };
	}];

 

On Android:

// Specify up to 20 key-value pairs (See https://stripe.com/docs/api#metadata)
Map metadata = new HashMap();
metadata.put("Source","POS");
metadata.put("Clerk Name", "John Appleseed");

TransactionParameters parameters =
		new TransactionParameters.Builder()
		.charge(new BigDecimal("10.00"), Currency.GBP)

		// This subject (max. 128 characters with spaces) will appear as the Description in the Stripe Dashboard
		.subject("Bouquet of Flowers")

		// Specify a Statement Descriptor
		.statementDescriptor("Bouquet")

		.metadata(metadata)
		.build();
,>,string>

 

All transactions will immediately appear in your Stripe Dashboard.

Make sure to use the payworks Testcard when testing, since real cards are not permitted on the test system. Transactions below GBP 0.30 will be declined by Stripe.

Going Live

Let us know once you are ready to go live and we will set up you up for the Live Gateway Manager.

When creating new Merchants in the Live Gateway Manager, please provide the Stripe Live Secret Key.

Accessing the Stripe Charge ID

If you need the Stripe Charge ID for a transaction, you can get it via MPTransaction in the completed block on iOS:

NSString *stripeChargeId = [[transaction clearingDetails] transactionIdentifier];

 

On Android use Transaction in the onActivityResult method:

Transaction transaction = MposUi.getInitializedInstance().getTransaction();
String stripeChargeId = transaction.getClearingDetails().getTransactionIdentifier();

 

You can also query the transaction from your backend and you will find it in the clearingDetails.transactionIdentifier property.

 

Using Stripe Connect

 

If you want to offer EMV & contactless payments as part of your marketplace or platform, payworks makes this easy for you as well with full support for Stripe Connect.

Working with Connected Accounts

In general, you need to provide the payworks platform with the Stripe Account ID (starting with acct_*) of the connected account that should receive the payment.

For Standalone Accounts, you first need to make sure, that the Standalone Account is successfully connected to your own Stripe Platform Account. The Stripe documentation explains how to implement the required OAuth workflow for this. In the last step of this workflow, you will receive the stripe_user_id, which must be provided as the Stripe Account ID.

For Managed Accounts, you will receive Stripe Account ID after creating the account.

During development and for pilots, you can perform all required Merchant Setup through the Gateway Manager as documented below. Later on, you can use the payworks API to automatically set up the Merchants on the payworks Platform.

Merchant Setup to Create Charges Directly on the Connected Account

In the Gateway Manager, create a new Merchant with a Stripe Processing Path and make sure to specify the Secret Key of your own Stripe Platform Account as the Stripe Secret Key.

To create the charge directly on the connected account, specify the Stripe Account ID of the connected account and select "Create Charges directly on the connected account" from the dropbox.

Merchant Setup to Create Charges on the Platform Account

In the Gateway Manager, create a new Merchant with a Stripe Processing Path and make sure to specify the Secret Key of your own Stripe Platform Account as the Stripe Secret Key.

To create the charge on your Stripe Platform account, specify the Stripe Account ID of the connected account and select "Create Charges on the platform account" from the dropbox.

If you want to refund a charge that has been created on your Stripe Platform Account, we strongly recommend that you use the Stripe API directly to refund the charge and make sure to set the reverse_transfer parameter to true.

See Accessing the Stripe Charge ID above to learn how to get the required Stripe Charge ID.

Collecting an Application Fee

When using Stripe Connect your platform can easily collect an application fee from your merchants.

On iOS just also provide the applicationFee parameter:

MPTransactionParameters *parameters =
[MPTransactionParameters chargeWithAmount:[NSDecimalNumber decimalNumberWithString:@"10.00"]
								 currency:MPCurrencyGBP
								optionals:^(id optionals)
	{
		// This subject will appear as the Description in the Stripe Dashboard
		optionals.subject = @"Bouquet of Flowers";
	
		// Specify a Statement Descriptor
		optionals.statementDescriptor = @"Bouquet";
	
		// Specify the Application Fee you want to receive (e.g. 1.23 equals 123 pence)
		optionals.applicationFee = [NSDecimalNumber decimalNumberWithString:@"1.23"];
	
		// Specify up to 20 key-value pairs (See https://stripe.com/docs/api#metadata)
		optionals.metadata = @{
							   @"Source" : @"POS",
							   @"Clerk Name" : @"John Appleseed"
							   };
	}];

 

Also on Android just also provide the applicationFee parameter:

// Specify up to 20 key-value pairs (See https://stripe.com/docs/api#metadata)
Map metadata = new HashMap();
metadata.put("Source","POS");
metadata.put("Clerk Name", "John Appleseed");

TransactionParameters parameters =
		new TransactionParameters.Builder()
		.charge(new BigDecimal("10.00"), Currency.GBP)

		// This subject will appear as the Description in the Stripe Dashboard
		.subject("Bouquet of Flowers")

		// Specify a Statement Descriptor
		.statementDescriptor("Bouquet")

		// Specify the Application Fee you want to receive (e.g. 1.23 equals 123 pence)
		.applicationFee(new BigDecimal("1.23"))

		.metadata(metadata)
		.build();
,>,string>

 

Can we help you?

If you cannot find your answer, contact us and we'll get in touch with you soon.

© Copyright 2020 Payworks GmbH. Legal.