Keep Network Tokens Current
Lifecycle Updates
Cards on file expire, get reissued and get closed. You don't track that for a Network Token: the card network keeps the token current after you provision it. When the issuer or network changes something, Basis Theory applies the change to the stored Network Token in place and sends a network-token.updated event. The token's id never changes, you don't re-provision it on expiry or reissue, and no cryptogram is involved.
What the card network can change
| Change | What triggers it | What changes on the Network Token |
|---|---|---|
| Status change | The issuer or network suspends, reactivates, deactivates or deletes the token, for example when a card is reported lost or an account is closed. A reissue that extends the token's expiry arrives the same way. | status, plus data.expiration_month and data.expiration_year when the network sends a new expiry. |
| Card update | The issuer changes details of the underlying card, such as its expiration date or last four digits after a reissue. | card.last4, card.expiration_month and card.expiration_year. The Network Token number and expiry stay the same. |
A status change is written straight from the network's notification. A card update notification carries no card data, so Basis Theory fetches the current details from the network before writing them. A notification that repeats what Basis Theory already stores changes nothing and sends no event.
When the network deletes a token, Basis Theory removes it and sends network-token.deleted instead of an update. Payments with that token fail from then on, so provision a new Network Token from the card.
Statuses
| Status | Meaning | Usable for payments |
|---|---|---|
active | Provisioned and valid. | Yes |
suspended | Temporarily blocked. You can suspend and resume a token through the API, and the issuer can suspend one on its side. | No |
inactive | Deactivated by the issuer or network. | No |
Act on an update
Subscribe to network-token.updated in your webhook configuration. The event carries the token's id, its new status, modified_at and an optional update_reason. It doesn't carry the new expiry or card details. If you store those values yourself, follow the event with Get a Network Token. If you only read the Network Token when you charge, there is nothing to do: the stored token is already current.
update_reason is a short code the card network attaches to a status change when it chooses to. Basis Theory passes it through unchanged and doesn't define the set of values. It's null when the network sends none and for suspend or resume requests you make through the API. Treat it as diagnostic and branch on status instead.
Actions you can take
| Action | Endpoint | Result |
|---|---|---|
| Suspend | Suspend a Network Token | status becomes suspended and network-token.updated is sent. |
| Resume | Resume a Network Token | status becomes active and network-token.updated is sent. |
| Delete | Delete a Network Token | The token is removed and network-token.deleted is sent. |
For your own suspend and resume requests, the event's modified_by is your application and update_reason is null. A suspend request for a token that is already suspended, or a resume request for an active token, returns 409 Conflict. See Lifecycle errors and retries.
Examples
Suspend a Network Token
Temporarily suspend a Network Token to prevent transaction processing while preserving the ability to reactivate:
async function suspendNetworkToken(req) {
const { bt, args } = req;
try {
const result = await bt.networkTokens.suspend(args.network_token_id);
console.log('Network Token suspended:', result.status);
return result;
} catch (error) {
console.error('Error suspending Network Token:', error);
throw error;
}
}
Resume a Network Token
Restore transaction capability for a previously suspended Network Token:
async function resumeNetworkToken(req) {
const { bt, args } = req;
try {
const result = await bt.networkTokens.resume(args.network_token_id);
console.log('Network Token resumed:', result.status);
return result;
} catch (error) {
console.error('Error resuming Network Token:', error);
throw error;
}
}
Delete a Network Token
Permanently delete a Network Token. The request returns no body, and the token can't be restored:
async function deleteNetworkToken(req) {
const { bt, args } = req;
try {
await bt.networkTokens.delete(args.network_token_id);
console.log('Network Token deleted:', args.network_token_id);
} catch (error) {
console.error('Error deleting Network Token:', error);
throw error;
}
}