Stripe - Android Canada Tap To Pay
Integration tips for Canada configured merchants.
As of ECP Android SDK v2.5.0, Android Tap To Pay transactions are now supported for Canada configured merchants.
This page will provide some additional tips for Canada configured merchants to help with integration. As you set up your integration, please reference the standard ECP Android SDK documentation pages as well. See the starting page for the ECP Android SDK documentation here: ECP - Android SDK
Language and Locale ConsiderationsConsumers integrating to the ECP Android SDK are responsible for following all required language regulations in their applications.
The Stripe M2 reader is not supported in Canada. For the ECP Android SDK, Canada merchants must use Tap To Pay on Android to accept payments. See the Tap To Pay guide for setup instructions. Additionally, this page will call out information to help consumers with integration for Canada configured merchants.
Complete Standard SDK and Tap To Pay Setup
Follow the standard ECP - Android SDK setup and Tap To Pay setup, referencing the following documentation pages: ECP - Android SDK , ECP - Android Framework , Stripe - Android Tap To Pay . For Tap To Pay specifically, some important general setup steps to ensure to follow include proper debuggable security setup (debuggable set to false), proper permissions declarations / requests, configuring SDK to Tap To Pay, and more. Tap To Pay specific steps are outlined in Stripe - Android Tap To Pay and additional tips to make a payment for Canada specific merchants will continue below.
Make a Payment with Tap To Pay - Canada
1. Initialize the SDK
Once your app has incorporated the latest dependencies, your app must initialize the SDK.
2. Configure SDK to Tap To Pay (Required for Canada)
To use Tap To Pay, your app must call the method Configure Reader Types in the SDK and pass in ECPSdkReaderConfigType.TAPTOPAY to the set of ECPSdkReaderConfigType. Configure Reader Types must be called after the SDK is initialized. Once your configured reader types includes tap to pay, your app can proceed to discover and connect to a compatible Tap To Pay device. Without the call to Configure Reader Types, the SDK will default to bluetooth-only discovery. At this time, bluetooth readers are not supported in Canada. Calling Configure Reader Types is standard procedure for any consumer integrating to Tap To Pay.
Example implementation (after initialize SDK):
HashSet<ECPSdkReaderConfigType> selectedReaderTypes = new HashSet<>();
selectedReaderTypes.add(ECPSdkReaderConfigType.TAPTOPAY);
_ecpSdk.configureReaderTypes(selectedReaderTypes, new ConfiguredReadersCallback() {
@Override
public void onComplete(boolean isReaderTypesConfigured, HashSet<ECPSdkReaderConfigType> hashSet, ECPSdkCallbackError ecpSdkCallbackError) {
runOnUiThread(new Runnable() {
@Override
public void run() {
String displayMessage;
if(isReaderTypesConfigured)
{
displayMessage = "successfully configured reader types: " + createStringFromHashSet(hashSet);
}
else
{
displayMessage = "failed to configure reader types: " + ecpSdkCallbackError.errorDescription;
}
responseView.setText(displayMessage);
}
});
}
});3. Discover and Connect to a Tap To Pay Device
After the SDK has been configured for Tap To Pay, your app can call Discover Devices. If a Tap To Pay device is found, your app can call Connect Device to attempt to connect to the Tap To Pay device. A Tap To Pay ECPDevice returned from a call to Discover Devices will have an id_number of "Android Tap To Pay".
4. Set Currency and Make a Payment With Tap To Pay
When creating ECPPaymentParameters for a Canada transaction, consumers will need to set the currency property to "cad" before calling makeSale. For a Canada transaction, a consumer must explicitly set the currency property to "cad". Otherwise, null or empty defaults to "usd". "cad" must be used for Canada configured merchants.
Example implementation, specifying "cad" on ECPPaymentParameters and calling makeSale:
ECPPaymentParameters params = new ECPPaymentParameters();
params.amount = "100.00";
params.external_id = "TestExternalId";
params.paymentDescription = "Test Description";
params.paymentDescriptionSuffix = "Test Suffix";
params.currency = "cad";
_ecpSdk.makeSale(params, new MakeSaleCallback() {
@Override
public void onComplete(boolean success, ECPSaleResponse saleResponse, ECPSdkCallbackError error) {
Log.i(TAG, "make sale completed. Success: " + success);
}
});Updated about 1 month ago
