Exchange Rate

👍

HTTPS POST / Server-to-Server

Sandbox endpoint : sandbox-pgw.2c2p.com/payment/4.1/ExchangeRate/secure
Run test with Swagger Editor

Go live when you are ready, Live endpoint is provided.

Exchange Rate API allow merchant to get forex rate.

Exchange Rate Request


Below are the guidelines that how to prepare a exchange rate request and send to 2c2p

  1. Prepare payload data. Below sample request data show the request structure. Refer Exchange Rate Request Parameter for API Specification.
{
      "merchantID": "JT01",
      "providerCode": "SCB",
      "currencyCode": "SGD"
}

 

  1. Generate JWT Token. Refer to Generate JWT Token
  2. Assign the JWT token to payload and send to payment token API
{
    "payload": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwYXltZW50VG9rZW4iOiIyNTRiNzdhNS01NTY4LTQ5Y2EtOWUwZS0yZjhkMjhiZTk1ZTciLCJpbnZvaWNlTm8iOiIyNTRiNzdhYWJjIiwibG9jYWxlIjoiZW4ifQ.r8EEFRXlNcLi566BrzroOh6qbjGSyWq
J9ZARSR5XwQ4"
}

 

Exchange Rate Response


Below are the guidelines that how to process exchange rate response from 2c2p.

  1. Exchange Rate API will return response data that contain JWT token. Sample response show below.
{
    "payload": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJtZXJjaGFudElEIjoiSlQwMSIsInByb3ZpZGVyQ29kZSI6IlNDQiIsImN1cnJlbmN5Q29kZSI6IlNHRCIsImV4cGlyZSI6MTU5NDc2MDQxMSwiZnhSYXRlcyI6W3sic2VxdWVuY2VObyI6MSwiaWQiOiIyQzJQMTBJUzcxQjBaWDZVVCIsIm5hbWUiOiJQb3VuZCBTdGVybGluZyIsImljb25VcmwiOm51bGwsImFtb3VudCI6bnVsbCwiZngiOjEuNjkzNzM4MiwiY3VycmVuY3lDb2RlIjoiR0JQIn0seyJzZXF1ZW5jZU5vIjoyLCJpZCI6IjJDMlAxQzlFM0hBT1BJMkVYIiwibmFtZSI6IkF1c3RyYWxpYW4gRG9sbGFyIiwiaWNvblVybCI6bnVsbCwiYW1vdW50IjpudWxsLCJmeCI6MC45MzY0MjYsImN1cnJlbmN5Q29kZSI6IkFVRCJ9LHsic2VxdWVuY2VObyI6MywiaWQiOiIyQzJQMUJEUE44NFlLTEoxMiIsIm5hbWUiOiJFdXJvIiwiaWNvblVybCI6bnVsbCwiYW1vdW50IjpudWxsLCJmeCI6MS41MzA3MTM4LCJjdXJyZW5jeUNvZGUiOiJFVVIifSx7InNlcXVlbmNlTm8iOjQsImlkIjoiMkMyUDFMSE5OMzYxWk5LQlUiLCJuYW1lIjoiVVMgRG9sbGFyIiwiaWNvblVybCI6bnVsbCwiYW1vdW50IjpudWxsLCJmeCI6MS4zNDk1Mjc3LCJjdXJyZW5jeUNvZGUiOiJVU0QifSx7InNlcXVlbmNlTm8iOjUsImlkIjoiMkMyUDE4TTRPMk4xWVZMRFEiLCJuYW1lIjoiWWVuIiwiaWNvblVybCI6bnVsbCwiYW1vdW50IjpudWxsLCJmeCI6MC4wMTI1NzIzLCJjdXJyZW5jeUNvZGUiOiJKUFkifSx7InNlcXVlbmNlTm8iOjYsImlkIjoiMkMyUDExQUxGSktTQVJBWEIiLCJuYW1lIjoiTmV3IFplYWxhbmQgRG9sbGFyIiwiaWNvblVybCI6bnVsbCwiYW1vdW50IjpudWxsLCJmeCI6MC44ODIwMjg3LCJjdXJyZW5jeUNvZGUiOiJOWkQifSx7InNlcXVlbmNlTm8iOjcsImlkIjoiMkMyUDFQNEFBM1UzNlBUNzAiLCJuYW1lIjoiSG9uZyBLb25nIERvbGxhciIsImljb25VcmwiOm51bGwsImFtb3VudCI6bnVsbCwiZngiOjAuMTc0MTA5OSwiY3VycmVuY3lDb2RlIjoiSEtEIn1dLCJyZXNwQ29kZSI6IjAwMDAiLCJyZXNwRGVzYyI6IlN1Y2Nlc3MifQ.1CzD4LX2HtnurYFiTsRbbLLirsXxHatDBi2OmjEApJo"
}
  1. You wouldn't recognize the meaning of JWT payload response and it is required to decode it, refer to Decode JWT Token

Below are sample payment inquiry response refer to Exchange Rate Response Parameter for API Specification.

{
  "merchantID": "JT01",
  "providerCode": "SCB",
  "currencyCode": "SGD",
  "expire": 1594760411,
  "fxRates": [
    {
      "sequenceNo": 1,
      "id": "2C2P10IS71B0ZX6UT",
      "name": "Pound Sterling",
      "iconUrl": null,
      "amount": null,
      "fx": 1.6937382,
      "currencyCode": "GBP"
    },
    {
      "sequenceNo": 2,
      "id": "2C2P1C9E3HAOPI2EX",
      "name": "Australian Dollar",
      "iconUrl": null,
      "amount": null,
      "fx": 0.936426,
      "currencyCode": "AUD"
    },
    {
      "sequenceNo": 3,
      "id": "2C2P1BDPN84YKLJ12",
      "name": "Euro",
      "iconUrl": null,
      "amount": null,
      "fx": 1.5307138,
      "currencyCode": "EUR"
    },
    {
      "sequenceNo": 4,
      "id": "2C2P1LHNN361ZNKBU",
      "name": "US Dollar",
      "iconUrl": null,
      "amount": null,
      "fx": 1.3495277,
      "currencyCode": "USD"
    },
    {
      "sequenceNo": 5,
      "id": "2C2P18M4O2N1YVLDQ",
      "name": "Yen",
      "iconUrl": null,
      "amount": null,
      "fx": 0.0125723,
      "currencyCode": "JPY"
    },
    {
      "sequenceNo": 6,
      "id": "2C2P11ALFJKSARAXB",
      "name": "New Zealand Dollar",
      "iconUrl": null,
      "amount": null,
      "fx": 0.8820287,
      "currencyCode": "NZD"
    },
    {
      "sequenceNo": 7,
      "id": "2C2P1P4AA3U36PT70",
      "name": "Hong Kong Dollar",
      "iconUrl": null,
      "amount": null,
      "fx": 0.1741099,
      "currencyCode": "HKD"
    }
  ],
  "respCode": "0000",
  "respDesc": "Success"
}