One-click saved cards
One-click lets a returning customer pay with a card they saved on an earlier visit — a single confirmation, no retyping the card, all inside your PaymentKit.js checkout. It builds on the Card payments flow, so start there if you don’t have a card checkout working yet.
PaymentKit.js gives you three things: the customer’s saved-card list, an optional CVC re-entry field, and the confirm call. You build the card picker UI yourself — there is no prebuilt picker element.
Before you begin
- Your account routes to Stripe (the only processor that supports one-click saved-card charges today — see Limitations).
- The checkout session is created with a
customer_id— one-click is never anonymous.
Create the checkout session
Create the session server-side with your secret key. Use mode: "payment" and a customer_id, then hand the returned secure_token to PaymentKit.js in the browser.
default_payment_method_id— optional. Suggests which saved card to preselect. It’s a prefill hint, not a lock; the customer can still pick another card, and the confirm call decides what is charged.saved_card_cvc_reprompt— optional, set per session at create time (there is no account-level setting).trueasks the customer to re-enter their security code, which generally improves approval rates. Omitted, it defaults tofalse(pure one-click, no CVC).
If you run your own backend, you can also list a customer’s saved cards server-side with your secret key. In the browser, use listSavedCards() (below) instead.
Charge the saved card in the browser
Initialize PaymentKit.js with the card payment method, exactly as in Card payments:
List the saved cards
listSavedCards() returns the session customer’s saved cards. Preselect the one flagged isDefault (this reflects default_payment_method_id), or the first card. Render the picker with your own UI.
If a customer has no saved cards, show your normal card form instead.
Re-prompt for the CVC when required
Read the session’s setting with getSavedCardCvcReprompt(). When it’s on, mount a CVC-only field for the selected card and disable the pay button until onLoaded fires — this stops a fast click from firing a CVC-less charge before the field is ready.
PaymentKit does not enforce CVC re-prompt on saved cards. If you don’t gate the charge on the CVC field (or collect a CVC another way), the charge is captured silently without a CVC, which lowers approval rates. Always disable the pay button until onLoaded fires, and if getSavedCardCvcReprompt() returns an error, treat re-prompt as on rather than firing a CVC-less charge.
Confirm the charge
Call confirmSavedCard() with the selected card’s id and cmpCardId, so a re-prompted CVC is re-collected against the right card.
confirmSavedCard() returns a Promise — it does not take the onSuccess / onError callbacks that submit() uses. Branch on the resolved result instead.
3D Secure is handled inline, identically to a fresh card — no extra code. For decline details (errors.checkout_response) and 3DS requirements, see Card payments.
Let the customer use a different card
There’s no swap API — this is just your own UI state. To let the customer enter a fresh card, unmount the CVC element and render the ordinary card elements, then charge with submit():
Limitations
- Stripe only today. A one-click saved-card charge routed to any other processor is rejected before any charge is attempted. Enable it on a Stripe route.
- You build the picker. PaymentKit.js gives you the card list, the CVC field, and the confirm call — not a prebuilt picker component. Render the list yourself.
- PaymentKit.js version. Requires
@payment-kit-js/vanilla >= <VERSION>— the release that addslistSavedCards,getSavedCardCvcReprompt,createSavedCardCvcElement, andconfirmSavedCard.
Replace <VERSION> with the published version before this page ships — check npm view @payment-kit-js/vanilla dist-tags. These methods are not in a released build yet.