PrimerCheckoutSheet is the prebuilt checkout UI. It opens a bottom sheet with a loading screen, payment method selection, the screens of the selected payment method, and the result screens. Render it inside PrimerCheckoutProvider and control it with the visible prop.
The sheet renders in a React Native Modal, above the rest of your app. For a custom UI, build your own layout from the components and hooks instead.
Props
PrimerCheckoutSheetProps is exported from @primer-io/react-native as a type.
Closing the sheet
You control the sheet withvisible. The sheet calls onRequestDismiss when:
- The shopper taps the backdrop, while
dismissOnBackdropPressistrue. - The shopper swipes the drag handle down.
- The shopper presses the Android back button on a screen without a Back button. On a screen with a Back button, Android back goes to the previous screen.
- The shopper taps Cancel.
- A success or pending result screen has been shown for 3 seconds.
- A result screen is turned off in settings. See Result screens.
paymentOutcome and your callbacks while PrimerCheckoutProvider stays mounted, also after the sheet closes.
What the sheet shows
- Loading. The sheet opens on a loading screen while the checkout starts and the payment method resources load.
- Payment method selection. Saved payment methods come first when the shopper has any, then the payment methods of the client session.
- The payment method. A card opens the card form, with the billing address fields when the client session asks for them. Other payment methods open their own screen: a bank list, Klarna, the Stripe ACH details and mandate, or a short form for Bancontact card, MB WAY and BLIK. Payment methods with a native UI, such as Apple Pay, Google Pay or PayPal, open it while the sheet shows a processing screen.
- Processing. A loading screen while the payment runs.
- Result. A success screen, a pending screen for a pending Stripe ACH payment, or an error screen with Retry and an option to choose another payment method.
Result screens
Two settings insettings.uiOptions turn off the result screens:
Your callbacks still run in both cases. Read the result as it arrives, as shown on the
usePrimerCheckout page.
When the checkout fails to start
WatchusePrimerCheckout().error, close the sheet, and start again with a new client token.
Opening the sheet again
The content of the sheet is rebuilt each time it opens, so entered values and visible field errors reset. The checkout state of the provider is kept. Use a new client token, or a newPrimerCheckoutProvider, for each checkout attempt.
Placement
RenderPrimerCheckoutSheet inside PrimerCheckoutProvider. It renders nothing until visible first becomes true, so a missing provider shows up as an error the first time the sheet opens:
PrimerCardFormProvider around it.
Styling
The sheet takes its look from the provider’stheme and from settings.uiOptions.appearanceMode. The sheet itself uses these tokens:
Usage
onDismiss, so each checkout attempt gets a new client token.
See also
PrimerCheckoutProvider
Start the session and set the callbacks.
usePrimerCheckout
Read the payment outcome from your own components.
PrimerSettings
Turn result screens on or off and set the appearance mode.
Handle the payment result
React to successful, pending and failed payments.