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.
Primer Checkout for React Native is a set of React components and hooks. You wrap your checkout in PrimerCheckoutProvider, then render the prebuilt PrimerCheckoutSheet or build your own layout from the components and hooks below. Import everything from @primer-io/react-native.

Core API

Card form

Payment methods

Theming

Common objects

Provider and hooks pattern

Every integration has one PrimerCheckoutProvider. The components and hooks below it share its checkout session. You customize the checkout by choosing which components to render and by building your own UI with the hooks. The quickest integration renders the prebuilt sheet inside the provider:
For your own layout, compose the components and hooks inside the provider. A card payment needs PrimerCardFormProvider around the card form, and the card payment method started with usePrimerPaymentMethod('PAYMENT_CARD'):
Set your own paying flag when the shopper taps Pay and clear it only if the payment fails, so a second tap can’t start a second payment. See Disable buttons during payment. Read the result of every payment from usePrimerCheckout().paymentOutcome. See Handle the payment result.

Where each hook works

A hook called outside the provider it needs throws an error that names the missing provider.

See also

PrimerCheckoutProvider

Start a checkout session and wrap your checkout UI.

PrimerCheckoutSheet

Run the whole checkout in a prebuilt bottom sheet.

usePrimerCheckout

Read the checkout state and the payment outcome.

Handle the payment result

React to successful, pending and failed payments.