PrimerSettings, which you pass to PrimerCheckoutProvider as settings.
Add the optional native dependencies
Add a dependency for each of these features that you enable in the Primer Dashboard. On iOS,Primer3DS is installed with PrimerSDK.
iOS
Add the pods to your app target inios/Podfile:
pod 'PrimerSDK' line with another version. The package pins it.
Without more build settings, the app fails to link these pods. In the default React Native setup, where pods link as static libraries, add this loop to the post_install block of your Podfile, after the react_native_post_install call:
pod install.
If your app links pods as dynamic or static frameworks, follow the steps for your linkage type in the React Native tab of the 3D Secure guide instead.
Android
Add the dependencies toandroid/app/build.gradle. Klarna’s Android SDK is served from Klarna’s own Maven repository, so add that repository too if you use Klarna:
These are the wrapper versions that the native Android SDK in this release is built with.
Register a URL scheme on iOS
Some payment methods, such as PayPal and Klarna, send the shopper to another app or to the browser and return to your app through a URL scheme. Register a scheme inios/<YourApp>/Info.plist:
paymentMethodOptions.iOS.urlScheme:
Apple Pay
Apple Pay is available on iOS only. On Android,usePrimerPaymentMethod('APPLE_PAY').isAvailable is false.
- In Xcode, select your app target, open Signing & Capabilities and add the Apple Pay capability. This adds the
com.apple.developer.in-app-paymentsentitlement. - Create a merchant identifier in the Apple Developer portal, for example
merchant.com.myapp, and select it under the Apple Pay capability. - Pass the merchant identifier in
paymentMethodOptions.applePayOptions:
merchantIdentifier must match the identifier you selected in Xcode. It is required to pay. Without it, selecting Apple Pay fails with a PrimerError. isCaptureBillingAddressEnabled is deprecated. Use billingOptions to request billing fields. Set the merchant name in the client session rather than in merchantName, which is deprecated.
Apple Pay also needs a payment processing certificate and Apple Pay set up for your processor in the Primer Dashboard. See Apple Pay. The prebuilt sheet shows Apple Pay with Apple’s own Apple Pay button.
For the other applePayOptions fields, see PrimerSettings.
Google Pay
Google Pay is available on Android only. On iOS,usePrimerPaymentMethod('GOOGLE_PAY').isAvailable is false.
Enable Google Pay in the Primer Dashboard. To change what the Google Pay sheet collects, set paymentMethodOptions.googlePayOptions:
googlePayOptions fields are optional. For the full list, see PrimerSettings.
3D Secure
AddPrimer3DS on iOS and io.primer:3ds-android on Android, as shown above. The native SDK runs the 3D Secure challenge. There’s no JavaScript API for it.
To send the shopper back to your app automatically after an out-of-band challenge in another app, set threeDsAppRequestorUrl for each platform. On iOS it must be a Universal Link, and on Android an App Link:
AppDelegate steps and Android manifest steps apply to Primer Checkout too.
Klarna
iOS
Add thePrimerKlarnaSDK pod and register a URL scheme. Without the pod, Klarna isn’t listed on iOS, or fails with the message PrimerKlarnaSDK missing.
Android
- Add
io.primer:klarna-androidand Klarna’s Maven repository, as shown above. - Add an activity that handles the URL Klarna returns to, in
android/app/src/main/AndroidManifest.xml:
MainActivity on android:launchMode="singleTask", as in the React Native app template, this returns the shopper to the running app.
- Pass the same URL as
klarnaOptions.returnIntentUrl:
Stripe ACH
AddPrimerStripeSDK on iOS and io.primer:stripe-android on Android, as shown above. Without the iOS pod, Stripe ACH fails with the message PrimerStripeSDK missing.
Then set paymentMethodOptions.stripeOptions with your Stripe publishable key and the mandate text:
- Set
publishableKey. - Set
mandateDatato exactly one of{ merchantName }, which fills your name into Primer’s standard mandate text, or{ fullMandateText }, which uses your own text. - Without
mandateData, the payment fails withstripe-ach-mandate-configwhen it reaches the mandate step, which comes after the shopper links a bank account. - On Android, the activity that hosts React Native must extend
androidx.activity.ComponentActivity. React Native’sReactActivitydoes. Otherwise Stripe ACH fails with a message that containsUnsupported activity type.
See also
Installation
Install the package and the iOS pods
PrimerSettings
Every settings key that affects Checkout Components
Handle the payment result
Read the outcome of each payment attempt
Troubleshooting
Fix installation and setup errors