Documentation
  • Documentation
  • Requirements
    • API Settings
  • Web SDKs and APIs
    • Components
    • Form (redirect)
      • Introduction
        • Demo Client (Test Client)
        • 3D Secure
      • Variables - names, lengths and formats
        • How to calculate digest
        • Supported Card Issuers
        • Form Rules
        • Installments
        • Tokenize Brands
        • Custom Params
        • Custom Attributes
        • Supported Payment Methods
        • Transaction Types
      • Notifications
    • LightBox
  • eCommerce Plugins
    • WooCommerce
    • Magento
    • Prestashop
  • Mobile SDKs
  • API Documentation
    • API v1
      • Direct API
      • Transaction management
    • API v2
      • Requirements - API v2
      • Payment API
      • Pay By Link API
      • Payment Method API
      • Token API
      • Customers API
      • Card on File Payment
      • Subscriptions
        • Create Subscription
        • Update Subscription
        • Create/Update/Get Response
      • Customer Subscription
        • Create Customer Subscription
        • Update Customer Subscription
        • Create/Update/Get Response
      • Recurring payments
    • Notifications
    • List of response codes
  • WebRisk
  • 🟣Knowledge Center
    • Payments
    • WebPay Account
Powered by GitBook
On this page
  • Create Token
  • Request
  • Response
  1. API Documentation
  2. API v2

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

name
value
description

path

v2/tokens

This path is used for create action

method

POST

We are creating/updating resource, hence POST method

Request body:

field
length
type
required
description

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

field
length
type
required
description

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

field
length
type
description

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"
  }
}
PreviousPayment Method APINextCustomers API

Last updated 2 years ago