PrimerPaymentMethodList renders the payment methods available in the current session as a column of buttons and calls onSelect when the shopper taps one. It doesn’t start a payment: you decide what happens next, usually with usePrimerPaymentMethod. To draw the list yourself, use the usePrimerPaymentMethods hook the component is built on.
Both need a PrimerCheckoutProvider above them. They don’t need PrimerCheckoutSheet, which shows its own method list.
Props
Default behavior
- While the checkout initializes and the payment method assets load, the list shows an activity indicator in the theme’s
loadercolor. - With no methods to show, it renders an empty view.
- Otherwise it renders one button per method,
spacing.smallapart, styled from the provider’s theme. The list doesn’t scroll on its own: place it in your ownScrollViewwhen it can be taller than the screen.
Usage
Show the list, then the screen for the chosen method:declare line stands for your own PaymentMethodScreen component for one method. Build it with usePrimerPaymentMethod, which tells you how to drive each method and starts it.
usePrimerPaymentMethods
usePrimerPaymentMethods returns the session’s payment methods as PaymentMethodItem objects, ready to render. It throws when called outside PrimerCheckoutProvider.
Options
include and exclude only change what the list shows. They don’t change which payment methods the session offers.
Returns
Usage
Build your own rows and hide the methods that can’t be used on this device. Each row callsusePrimerPaymentMethod for its own method, so it can start a native-UI method (such as Apple Pay or Google Pay) straight from the tap:
PaymentMethodItem
One payment method, ready to render.See also
usePrimerPaymentMethod
Start and drive any payment method by its type.
usePrimerVaultManager
List and pay with the customer’s saved payment methods.
usePrimerCheckout
Checkout state and the payment outcome.
PrimerCheckoutSheet
The prebuilt sheet with its own method list.