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

deleteCard

​​ Overview

deleteCard revokes a previously enrolled card on its network, so the stored virtualCardId can no longer start a payment. Use it when the buyer removes a saved card from your surface. It wraps the REST Delete Card endpoint.

Two call shapes, matching the endpoint:

  • With a live FlowSession — pass { session } while you still hold the session from the current flow.
  • Partner-direct cleanup — pass { network, virtualCardId } when the session is long gone (for example, a settings page where the buyer deletes a card enrolled days earlier).

​​ Signature


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

​​ Parameters

  • input.session (FlowSession) — A live session from enrollCard / selectCard. When set, network and virtualCardId are ignored.

  • input.network (string) — 'visa', 'mastercard', or 'discover'. Required when session is omitted.

  • input.virtualCardId (string) — The virtualCardId from an earlier EnrollResult. Required when session is omitted.

  • input.reason (string) — 'SUSPECTED_FRAUD' | 'ACCOUNT_CLOSED' | 'OTHER' | 'DEFAULT'. Recorded by the network for audit.

  • input.requestor (string) — 'CARDHOLDER' | 'MERCHANT' | 'ISSUER' | 'WALLET'. Recorded by the network for audit.

  • options.apiTokenOverride (string) — Per-call bearer override.

  • options.signal (AbortSignal) — Abort the request.

​​ Returns

Promise<{ deleted: boolean, srcCorrelationId: string | null }>

  • deletedtrue when the network confirmed the revocation
  • srcCorrelationId — Network correlation reference when the network returns one, otherwise null

The session, if supplied, is not refreshed — no later SDK call accepts a session for a deleted card.

​​ Example


// Buyer removes a saved card from your settings page — no live session.
const { deleted } = await fap.deleteCard({
network: savedCard.network,
virtualCardId: savedCard.virtualCardId,
reason: 'ACCOUNT_CLOSED',
requestor: 'CARDHOLDER'
});
if (deleted) removeFromSavedCards(savedCard.virtualCardId);