Credit Card Customer Token

Tokenizing credit cards

Security considerations when Tokenizing credit cards

For traditional credit cards (eg. VISA, MasterCard, AMEX), you will want to provide some security information, in order to increase the chances of a successful transaction.

We support the following security methods:

  • 3DS2

  • 3DS1

  • MOTO

Depending on the specified security method, additional data will be required.

3DS2

Attribute
Explanation

cavv

The authenticationValue from your 3D Secure 2 provider

dsTransID

The unique transaction identifier assigned by the DS to identify a single transaction

eci

The electronic commerce indicator

3DS1

Attribute
Explanation

authenticationResponse

From the paResponse from the issuer access control system

directoryResponse

The enrollment response from the VERes message from the directory server

cavv

The authentication value for the 3D Secure authentication session. The returned value is a Base64-encoded 20-byte array

cavvAlgorithm

The CAVV Algorithm used during the authentication

xid

The transaction identifier assigned by directory server (base64 encoded, 20 bytes in a decoded form)

eci

The electronic commerce indicator

MOTO

This is a fallback method if no 3DS information is available.

Create a credit card customer token

Here is an example of a successful request for a credit card tokenisation, with 3DS1.

Create customer token using a credit card

POST https://staging.api.xpay.xcover.com/customer-tokens/credit-card

Headers

Name
Type
Description

Authorization*

string

Bearer {{JWT}}

{
    "customer": {
      "email": "[email protected]"
    },
    "creditCard": {
      "number":"4917610000000000",
      "expiryMonth":"03",
      "expiryYear":"2030",
      "cvc":"737",
      "holderName":"John Smith",
      "cavv": "3q2+78r+ur7erb7vyv66vv\/\/\/\/8=",
      "eci": "05",
      "dsTransID": "c4e59ceb-a382-4d6a-bc87-385d591fa09d" 
    },
    "securityMethod": "3DS2",
    "reference": "Your random reference value"
}

Failure Scenarios

There are many reasons why a tokenization of a credit card may fail. Here are some examples.

Missing Card Details

{
    "customer": {
      "email": "[email protected]"
    },
    "creditCard": {},
    "securityMethod": "3DS2",
    "reference": "existing reference value"
}

Card Declined

{
    "customer": {
      "email": "[email protected]"
    },
    "creditCard": {
      "number":"4917610000000000",
      "expiryMonth":"03",
      "expiryYear":"2030",
      "cvc":"{{ Wrong CVC }}",
      "holderName":"John Smith",
      "cavv": "3q2+78r+ur7erb7vyv66vv\/\/\/\/8=",
      "eci": "05",
      "dsTransID": "c4e59ceb-a382-4d6a-bc87-385d591fa09d" 
    },
    "securityMethod": "3DS2",
    "reference": "Your random reference value"
}

Invalid Credit Card Number

{
    "customer": {
      "email": "[email protected]"
    },
    "creditCard": {
      "number":"{{ INVALID NUMBER }}",
      "expiryMonth":"03",
      "expiryYear":"2030",
      "cvc":"WRONG CVC",
      "holderName":"John Smith",
      "cavv": "3q2+78r+ur7erb7vyv66vv\/\/\/\/8=",
      "eci": "05",
      "dsTransID": "c4e59ceb-a382-4d6a-bc87-385d591fa09d" 
    },
    "securityMethod": "3DS2",
    "reference": "Your random reference value"
}

Last updated