These docs are for v4.0.2. Click to read the latest docs for v4.3.0.

Card Tokenization

1. Prepare Payment Token Request

Refer to the required parameters below to create a payment token.

📘

Please refer: Payment Token API Request

Pre Requisite

  1. MerchantID, secret code & currencyCode are provided by 2C2P.
  1. Payment Channel set to CC
  1. tokenize set to true
{
    "merchantID": "JT01",
    "invoiceNo": "1523953661",
    "description": "item 1",
    "amount": 1000.00,
    "currencyCode": "SGD",
    "tokenize": true, //set to true to enable tokenization
    "paymentChannel" : ["CC"] //Tokenization feature is only available for credit card payment option only
}

 

2. Receive Payment Token Response

Refer to the sample payment token response below.

📘

Please refer: Payment Token API Response

{
  "webPaymentUrl": "https://sandbox-pgw-ui.2c2p.com/payment/4.1/#/token/kSAops9Zwhos8hSTSeLTUcCrwcnrndJUZanGJy3fBEsXCiYmynwxHvK5h7XPBadJqD0nG7v65t5N2jPVrnwX2jL4nu%2bKKSegjUjERKCyWPg%3d",
  "paymentToken": "kSAops9Zwhos8hSTSeLTUcCrwcnrndJUZanGJy3fBEsXCiYmynwxHvK5h7XPBadJqD0nG7v65t5N2jPVrnwX2jL4nu+KKSegjUjERKCyWPg=",
  "respCode": "0000",
  "respDesc": "Success"
}

 

3. Validation of Payment Token

Proceed only when the parameter "respCode" is "0000". Otherwise, terminate the payment process. Refer to the Payment Response Code below.

🚧

Please Refer : Payment Response Code

 

4. Redirect to Payment Page

Redirect to the payment page via browser. The payment page URL is returned from the Parameter "webPaymentUrl". Customers are required to tick the save card checkbox to store their card details.

 

5. Receive Payment Response via backend API

📘

Please Refer : Payment Response - Backend API

The parameter "backendReturnUrl" that was previously sent via Payment Token Request is the merchant endpoint that will a receive backend notification. If the parameter "backendReturnUrl" is not set, the system will obtain the backend return url from the merchant profile set in the 2C2P merchant portal by default.

{
  "merchantID": "JT04",
  "invoiceNo": "280520075921",
  "cardNo": "411111XXXXXX1111",
  "amount": "230.87",
  "currencyCode": "THB",
  "cardToken": "28052010234224845229" //receive card token,use for subsequent payment
  "tranRef": "2868821",
  "referenceNo": "2785703",
  "approvalCode": "531484",
  "eci": "05",
  "transactionDateTime": "20200528080508",
  "respCode": "0000",
  "respDesc": "Success"
}

 

6. Receive Payment Response via browser redirection

📘

Please Refer : Payment Response - Frontend API

Fill in the parameter "frontendReturnUrl" with the merchant page that you wish to redirect to. If the parameter "frontendReturnUrl" is not set, the system will obtain the front end return url from the merchant profile set in 2C2P's merchant portal by default. Refer to the sample response returned below.

{"invoiceNo":"280520075921","channelCode":"CC","respCode":"2000","respDesc":"Transaction is completed, please do payment inquiry request for full payment information."}

The parameter "respCode" specifies the status of the transaction and also indicates what action should performed next. Refer to the Payment Flow Response Code below.

🚧

Please Refer : Payment Flow Response Code

 

7. Payment Inquiry to retrieve the payment information

📘

Please Refer : Payment Inquiry API

For merchants who do not implement "Receive Payment Response via backend API", they are required to call Payment Inquiry API to receive the payment response.