Docs
Firmly Agentic Commerce
Set theme to dark (⇧+D)

selectCard

​​ Overview

selectCard re-establishes a payable session for a card the cardholder enrolled earlier. It takes the durable virtualCardId from a prior enrollCard result — no PAN re-entry — and returns the same EnrollResult shape, so the rest of the flow (createIntent → completeOrder) is identical.

On a revoked token the call rejects (it does not resolve with an error value) — the SDK throws ErrorPaymentMethodNotAvailable, which corresponds to the REST PaymentMethodNotAvailable (409). Catch it and fall back to enrollCard (collect the PAN again).

​​ Signature


const result = await fap.selectCard(input, options);

​​ Parameters

  • input.network (string, required) — "visa" or "mastercard" — the network the stored card belongs to.

  • input.virtualCardId (string, required) — The durable handle from a prior enrollCard / selectCard result. Note the casing: this is camelCase virtualCardId (the SDK-level handle), whereas enrollCard’s card-detail inputs use snake_case (expiry_month) to mirror the raw enroll body, and the raw REST endpoints use snake_case virtual_card_id.

  • input.consumer (object) — Cardholder identity. email is required for Visa (the wallet re-binds the consumer identity from it); optional for Mastercard.

  • options (object) — Optional CallOptions: apiTokenOverride, signal.

​​ Returns

Promise<EnrollResult> — the same shape as enrollCard: { session, virtualCardId, verificationMethods, cardArt, masked }.

cardArt and masked are always null here — use the values you persisted at enroll time.

​​ Example


// returning customer — no PAN
const selected = await fap.selectCard({
network: 'mastercard',
virtualCardId: savedCard.virtualCardId
// consumer.email required for Visa
});
// Capture and forward the advanced session from each step.
const intent = await fap.createIntent(selected.session, mandate, { container });
await fap.completeOrder(intent.session, { billingInfo });