Skip to main content

Storing a network token

A card can be stored as a network token, a token issued by the card scheme in place of the card number. Network tokens are currently supported for Visa and Mastercard cards.

To create a network token vault instrument, set type to network_token and provide a customer.id that identifies your customer. You can then either:

  • provide the card details, or
  • provide the instrument_id of an existing, active card vault instrument to create a network token from the card already stored in the vault.

A successful request returns a synchronous response with a pending status while we request the network token from the card scheme:

  • Once the network token has been issued, the vault instrument's status becomes active and an instrument_activated webhook is sent. The vault instrument can then be used to process payments, as described here.
  • If the network token cannot be issued, the vault instrument's status becomes failed and an instrument_failed webhook is sent. The webhook and the vault instrument both include an errors array with a code and reason explaining why. The codes are listed under Network tokens.

While a network token vault instrument is pending or failed, it cannot be suspended, reactivated or have its card expiry updated. Deleting a network token vault instrument also deletes its network token.

The card scheme can also change a network token after it has been issued, for example when the card is reported lost or renewed by the issuer. The vault instrument follows these changes: it is suspended, reactivated, updated or deleted, and the usual vault webhooks are sent.

note

Details on required fields and validation can be found in our Open API specification.


POST https://api.paytently.io/instruments

Request:​

curl --location 'https://sandbox.api.paytently.io/instruments'
--header 'Content-Type: application/json'
--header 'Authorization: Bearer token_here'
--data-raw '{
"type": "network_token",
"card": {
"number": "5120350100064594",
"expiry_month": "06",
"expiry_year": "28",
"name_on_card": "Bob Bobinson"
},
"customer": {
"id": "customer123"
},
"urls": {
"webhook": "https://example.com/webhooks"
}
}'

Response:​

{
"id": "ins_67890",
"status": "pending"
}

Errors:​

CodeDescription
customer_requiredcustomer must be provided for a network token.
customer_id_requiredcustomer.id must be provided for a network token.
customer_id_invalidcustomer.id must be between 1 and 64 characters.
card_requiredcard must be provided when instrument_id is not.
card_not_allowedcard cannot be provided with instrument_id.
scheme_unsupportedThe card scheme is not supported for network tokens.
network_tokens_not_configuredYour account is not set up for network tokens on this card scheme.
instrument_not_foundThe vault instrument in instrument_id could not be found.
instrument_not_a_cardThe vault instrument in instrument_id is not a card vault instrument.
instrument_suspendedThe vault instrument in instrument_id is suspended.
instrument_expiredThe vault instrument in instrument_id has expired.