m2pfintech
API LibraryForex

Get foreign exchange rate for currency conversion

Retrieve the current foreign exchange rate for converting between two currencies. The response includes the base exchange rate, applied markup percentage, effective rate after markup, and a validity window for the quoted rate.

The rate quote is time-limited. Use it within the validTill timestamp to ensure the quoted rate is honored. After expiry, request a fresh rate.

Common use cases include displaying conversion rates to customers before international transactions, calculating forex charges, and pre-authorization amount estimation.

POST
/Yappay/forex-manager/getRate

Authorization

BearerAuth TenantHeader
AuthorizationBearer <token>

JWT Bearer token obtained from the /auth/login endpoint

In: header

TENANT<token>

Tenant identifier provided by M2P (e.g. ENBDTABBY)

In: header

Request Body

application/json

fromCurrency*string

Source currency code in ISO 4217 format

toCurrency*string

Target currency code in ISO 4217 format

amount*number

Amount in source currency to convert. Must be greater than zero.

Formatdouble
Range0.01 <= value

Response Body

application/json

application/json

application/json

curl -X POST "https://api.m2p.com/Yappay/forex-manager/getRate" \  -H "Content-Type: application/json" \  -d '{    "fromCurrency": "INR",    "toCurrency": "USD",    "amount": 10000  }'
{
  "status": "success",
  "data": {
    "fromCurrency": "INR",
    "toCurrency": "USD",
    "exchangeRate": 0.01198,
    "fromAmount": 10000,
    "toAmount": 119.8,
    "markup": 2.5,
    "effectiveRate": 0.01168,
    "validTill": "2026-03-06T10:35:00Z"
  }
}

{
  "result": null,
  "exception": {
    "detailMessage": "Unsupported currency pair INR to XYZ",
    "shortMessage": "Unsupported currency pair",
    "errorCode": "FX_001",
    "languageCode": "en"
  },
  "pagination": null
}

{
  "result": null,
  "exception": {
    "detailMessage": "Exchange rate feed is temporarily unavailable",
    "shortMessage": "Rate feed unavailable",
    "errorCode": "FX_004",
    "languageCode": "en"
  },
  "pagination": null
}