Ginger Payments
Card vault

Store a card

POST
/v1/cards/

Stores card details in the vault and returns a vault_token that represents the card. Use it to authenticate a transaction, and store it for one-click and recurring payments.

Get the setup_token from the payment_method_details of the transaction when you create the order. It works once, within 300 seconds after the order was created.

You need to be PCI DSS compliant to send card data to this endpoint. See Server-to-server.

Authorization

apiKey
headerAuthorizationBasic <token>

Use your project's API key as the username and leave the password empty. Only use the API key from your server: it gives full access to your project.

Request Body

application/json
  1. body
name?string

Cardholder name as printed on the card.

Length1 <= length <= 120
pan*string

Card number without spaces.

Match^[0-9]{12,19}$
expiry*string

Expiry date in MMYYYY format, such as 012030 for January 2030.

Match^(0[1-9]|1[0-2])[0-9]{4}$
setup_token*string

The setup_token from the payment_method_details of the transaction.

Formatuuid

Response Body

The card has been stored.

application/json
  1. response
vault_token?string

Token that represents the card. Store it to use the card again.

Formatuuid
truncated_pan?string

Masked card number.

brand?string

Detected card brand, such as visa.

brands?array<string>

All brands detected for the card.

curl -X POST 'https://tokens.dev.gingerpayments.com/v1/cards/' \  -H 'Content-Type: application/json' \  -d '{  "name": "John Smith",  "pan": "4111111111111111",  "expiry": "012030",  "setup_token": "87f05a5d-1755-48c7-8161-f8a9544e56bf"}'
{  "vault_token": "d972dc43-6a3d-4dcf-b54e-6e9a0fe325e3",  "truncated_pan": "4111********1111",  "brand": "visa",  "brands": [    "visa"  ]}