Skip to content

Search is only available in production builds. Try building and previewing the site to test it out locally.

StoredCards Container

The StoredCards container renders a Stored payment methods section with one radio row per vaulted card (brand, masked number, expiry) and an optional Pay with a new card option. The host checkout block handles loading tokens, syncing the cart when a card is selected, and mounting the CreditCard form when the shopper chooses a new card. See Vaulted cards at checkout.

The screenshots below show the Payment section when Credit card is selected and vaulted cards are available—showing the same flows described in the Vaulted cards at checkout tutorial.

The shopper selects a vaulted card. The host typically syncs the selected token to the cart and does not mount the hosted card form.

Checkout with a stored Visa card selected

Stored payment methods with a saved card selected

The shopper selects Pay with a new card. The host mounts the CreditCard form in the same checkout section.

Checkout with Pay with a new card selected

Stored payment methods with Pay with a new card selected and card form visible

The StoredCards container accepts standard fieldset HTML attributes plus:

ParameterTypeReq?Description
cardsStoredCard[]YesVault rows to display. Each StoredCard includes publicHash and optional brand, maskedNumber, expiry, holderName.
onPaymentChoicefunctionNoCalled when the shopper selects a saved card or Pay with a new card. Payload is { kind: 'vault', card } or { kind: 'new' }.
payWithNewCardLabelstringNoWhen set, renders an extra radio row after stored cards (for example, Pay with a new card).
selectedChoiceobject | nullNoControlled selection: { kind: 'new' } or { kind: 'vault', publicHash: string }.

This container does not expose any customizable slots.

import { StoredCards } from '@dropins/storefront-payment-services/containers/StoredCards.js';
import { render as provider } from '@dropins/storefront-payment-services/render.js';
await provider.render(StoredCards, {
cards: [/* mapped from vault tokens */],
payWithNewCardLabel: 'Pay with a new card',
onPaymentChoice: (choice) => {
/* sync cart, mount or hide CreditCard */
},
})(document.getElementById('stored-cards'));

For end-to-end wiring (tokens, syncVaultToCart, place order), use the vault helpers and the Vaulted cards at checkout tutorial.