Token API

Create Token

Request

To create a Token you'll need to provide:

  • Valid request with a defined type = card

  • Required fields (described below)

Request endpoint details

namevaluedescription

path

v2/tokens

This path is used for create action

method

POST

We are creating/updating resource, hence POST method

Request body:

fieldlengthtyperequireddescription

type

enum

String

YES

Possible values are: card

card

predefined

Card

YES

An object containing pan and expiration date

metadata

predefined

Map

NO

An optional field for metadata in key:value pairs

Card

fieldlengthtyperequireddescription

pan

12 or more

String

YES

Card's primary account number

expiration_date

3-4

String

YES

Has to be in format YYMM e.g. if expiration date is in June 2022, the value is 2206

Request Example

{
  "type": "card",
  "card": {
    "pan": "4242424242424242",
    "expiration_date": "2802"
  },
  "metadata": {
    "description": "Card description - optional value"
  }
}

Response

fieldlengthtypedescription

token

48

String

A really long string

status

predefined

String

Possible values are: approved or invalid-request

keep_until

predefined

Date

Date until token is valid

maked_pan

12

String

Masked primary account number

expiration_date

4

String

Card's expiration date

Example of response:

{
  "token": "eefb5438ff1b7a1b14b20ab5b809c61b129966b60e502390",
  "status": "approved",
  "card": {
    "keep_until": "2096-03-01T00:00:00Z",
    "masked_pan": "411111****1111",
    "expiration_date": "9602"
  }
}

Last updated