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 fromenrollCard/selectCard. When set,networkandvirtualCardIdare ignored. -
input.network(string) —'visa','mastercard', or'discover'. Required whensessionis omitted. -
input.virtualCardId(string) — ThevirtualCardIdfrom an earlierEnrollResult. Required whensessionis 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 }>
deleted—truewhen the network confirmed the revocationsrcCorrelationId— Network correlation reference when the network returns one, otherwisenull
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);
Related
- Delete Card API — the underlying endpoint
selectCard— rejects withPaymentMethodNotAvailablefor a deleted card