Skip to main content
Primer Checkout React Native SDK is currently in beta (v3.0.0-beta.1). The API is subject to change before the stable release.
The core SDK needs no native setup beyond installation. Some payment methods need changes in your iOS or Android project and options in 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 in ios/Podfile:
Don’t add a 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:
The loop lists all three pods. Leave out the entries of a pod you don’t add. Then run 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 to android/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 in ios/<YourApp>/Info.plist:
Then pass a URL with that scheme as paymentMethodOptions.iOS.urlScheme:

Apple Pay

Apple Pay is available on iOS only. On Android, usePrimerPaymentMethod('APPLE_PAY').isAvailable is false.
  1. In Xcode, select your app target, open Signing & Capabilities and add the Apple Pay capability. This adds the com.apple.developer.in-app-payments entitlement.
  2. Create a merchant identifier in the Apple Developer portal, for example merchant.com.myapp, and select it under the Apple Pay capability.
  3. 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:
All googlePayOptions fields are optional. For the full list, see PrimerSettings.

3D Secure

Add Primer3DS 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:
For the Universal Link and App Link setup of your domain and app, see “Handle Out-of-Band (OOB) redirects” in the React Native tab of the 3D Secure guide. Its iOS AppDelegate steps and Android manifest steps apply to Primer Checkout too.
The 3D Secure SDK runs security checks that fail on debug builds, emulators and apps not installed from a store. During development, you can turn them off with debugOptions: { is3DSSanityCheckEnabled: false }. Never ship that setting in a production build.

Klarna

iOS

Add the PrimerKlarnaSDK pod and register a URL scheme. Without the pod, Klarna isn’t listed on iOS, or fails with the message PrimerKlarnaSDK missing.

Android

  1. Add io.primer:klarna-android and Klarna’s Maven repository, as shown above.
  2. Add an activity that handles the URL Klarna returns to, in android/app/src/main/AndroidManifest.xml:
The activity only has to bring your app back:
With MainActivity on android:launchMode="singleTask", as in the React Native app template, this returns the shopper to the running app.
  1. Pass the same URL as klarnaOptions.returnIntentUrl:
Without returnIntentUrl, Klarna on Android fails with klarna-return-url-missing when the shopper selects a Klarna payment category. iOS doesn’t use returnIntentUrl.

Stripe ACH

Add PrimerStripeSDK 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 mandateData to 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 with stripe-ach-mandate-config when 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’s ReactActivity does. Otherwise Stripe ACH fails with a message that contains Unsupported 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