All of them must be inside
PrimerCheckoutProvider. They don’t need PrimerCardFormProvider. The detected network comes from the native SDK’s BIN data, which exists only while the card form is active: after start() on usePrimerPaymentMethod('PAYMENT_CARD'), or inside PrimerCheckoutSheet.
usePrimerCardNetwork
Returns the detected network with its traits and icon.UseCardNetworkReturn.
descriptorstarts as the default descriptor on every network change and updates when the native SDK returns the traits. It stays the default when the native SDK has no traits for the network or the lookup fails.iconSourceis only for the detected network. For the icons of other networks, usePrimerCardNetworkSelectororPrimerAcceptedCardNetworks.
usePrimerCardNetworkSelection
Returns the networks of a co-badged card and lets you record the shopper’s choice.UsePrimerCardNetworkSelectionReturn.
- The choice is sent with the card data until the shopper changes the card number to one whose detected networks no longer include it. The SDK then drops the choice and
selectedNetworkreturns tonull. - Without a choice, no network is sent with the card data.
- The choice is also dropped when the card form stops being active.
Building your own selector
CardNetworkDetails
A network inusePrimerCardNetworkSelection. All fields are read-only.
PrimerCardNetworkSelector
The co-badged network selector thatPrimerCardNumberInput shows inside the card number field. Render it yourself only next to your own card number field.
The props type is exported as
PrimerCardNetworkSelectorProps. The selector reads usePrimerCardNetworkSelection() and renders one of three states:
A badge shows the network’s icon. Without an icon it shows a two-letter abbreviation, for example
CB for Cartes Bancaires, or a generic card image when there is no abbreviation.
PrimerAcceptedCardNetworks
A horizontal row of small chips for the card networks your session accepts. Add it to your own layout, for example above the card number.- Without
networks, it showsacceptedCardNetworksfromusePrimerCheckout(): the networks the session accepts, in order. The SDK loads them when the checkout is ready and again when the client session changes. - Each chip shows the network’s icon, or a two-letter abbreviation while there is no icon.
- It renders nothing while the list is empty or not loaded yet.
- Duplicate networks are shown once, in the order given.
PrimerAcceptedCardNetworksProps.
CardNetworkId
The identifiers of the networks the SDK knows:BinData
The BIN data the native SDK reports for the card number. Read it fromusePrimerCardForm().binData or the onBinDataChange option of usePrimerCardForm. The type is exported as BinData.
BinDataStatus is also exported.
CardNetwork, also exported, describes one detected network:
See also
usePrimerCardForm
Card form state, including
binData and descriptor.Card inputs
PrimerCardNumberInput and its built-in selector.PrimerCardForm
The card fields in a fixed layout.
Display card network
Show the detected card network as the shopper types.