DocumentationRecipesAPI ReferenceChangelog
Documentation

Exchange Rate With Token

👍

HTTPS POST / Server-to-Server

Requests and Responses are encrypted using JWT

  • Algorithm : HMAC SHA-256 using Merchant’s Secret Key.

Refer JWT Token Guide on how to prepare requests and process responses.

https://sandbox-pgw.2c2p.com/payment/4.3/exchangerate
https://pgw.2c2p.com/payment/4.3/exchangerate
📘

API Parameter

Exchange Rate With Token Request Parameters Exchange Rate With Token Response Parameters

The Exchange Rate With Token API allows merchants to get foreign exchange rates with payment tokens.

Exchange Rate With Token Request


To prepare an exchange rate with token request, refer to the guidelines below.

  1. Send a request and receive a response from the Payment Token API.

  2. Prepare payload data. The sample code below demonstrates the correct data structure for an API request.

{
    "paymentToken": "kSAops9Zwhos8hSTSeLTUcCrwcnrndJUZanGJy3fBEsXCiYmynwxHvK5h7XPBadJqD0nG7v65t5N2jPVrnwX2jL4nu+KKSegjUjERKCyWPg=",
    "clientID": "E380BEC2BFD727A4B6845133519F3AD7",
    "locale": "en",
    "bin": "411111"
}
curl --location --request POST 'https://sandbox-pgw.2c2p.com/payment/4.3/exchangerate' \
--header 'Content-Type: application/json' \
--data-raw '{
    "paymentToken": "kSAops9Zwhos8hSTSeLTUcCrwcnrndJUZanGJy3fBEsXCiYmynwxHvK5h7XPBadJqD0nG7v65t5N2jPVrnwX2jL4nu+KKSegjUjERKCyWPg=",
    "clientID": "E380BEC2BFD727A4B6845133519F3AD7",
    "locale": "en",
    "bin": "411111"
}'

 

Exchange Rate With Token Response


To process a response from the Exchange Rate With Token API, refer to the guidelines below.

The sample code below demonstrates the structure for the API response.

{
    "paymentToken": "kSAops9Zwhos8hSTSeLTUcCrwcnrndJUZanGJy3fBEsXCiYmynwxHvK5h7XPBadJqD0nG7v65t5N2jPVrnwX2jL4nu+KKSegjUjERKCyWPg=",
    "providerCode": "SCB",
    "expire": 1545383164989,
    "fxRates": [{
        "sequenceNo": 1,
        "id": "fx001",
        "name": "SGD",
        "iconUrl": "https://img.2c2p.com/pgw/fx/flag_sg.png",
        "amount": "1500.00",
        "fx": 1.0,
        "currencyCode": "SGD"
    }, {
        "sequenceNo": 2,
        "id": "fx002",
        "name": "THB",
        "iconUrl": "https://img.2c2p.com/pgw/fx/flag_th.png",
        "amount": "2450.00",
        "fx": 24.50,
        "currencyCode": "THB"
    }],
    "respCode": "0000",
    "respDesc": "success"
}

Run test with Swagger Editor