Skip to content

Search is only available in production builds. Try building and previewing the site to test it out locally.

Get Exchange Rates

This endpoint returns the currency conversion rate for a deposit transaction, based on the specified country and amount.
It helps you confirm the expected conversion before initiating the deposit.


Purpose

  • Determine the applicable exchange rate before processing a deposit.
  • Provide customers with accurate converted amounts.
  • Ensure transparent fee and currency conversion calculations.

Endpoint

Method: POST
URL:

/api/v1/pay-in/deposit-creation/exchange-rates

Authentication:
This endpoint requires Basic Authentication with your Cashela Business Key and Business Secret.

Required Headers:

Authorization: Basic Base64({business_key}:{business_secret})
Content-Type: application/json
Accept: application/json
Idempotency-Key: <uuid-v4>

Request Parameters

FieldTypeRequiredDescription
countrystringYesISO 3-letter country code obtained from Get Available Countries.
amountnumberYesDeposit amount in the original currency.

Example cURL Request

Terminal window
curl -X POST "https://api.cashela.com/api/v1/pay-in/deposit-creation/exchange-rates" \
-H "Authorization: Basic BASE64_ENCODED_KEY_SECRET" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Idempotency-Key: 0a4e2d2e-6c0c-4c69-9b2e-6f8a7f3a1c9f" \
-d '{
"country": "MEX",
"amount": 100
}'

Example Response

{
"success": true,
"data": {
"country": "MEX",
"amount": 100,
"exchange_rates": {
"fx_rate": 17.2,
"currency": "MXN",
"converted_amount": 1720
}
}
}

Response Fields

FieldTypeDescription
successbooleanIndicates if the request was successful.
data.countrystringCountry code used for the conversion.
data.amountnumberOriginal amount provided in the request.
exchange_rates.fx_ratenumberConversion rate applied.
exchange_rates.currencystringTarget currency code.
exchange_rates.converted_amountnumberConverted amount after applying the exchange rate.

Common Use Case

  1. Select a country from Get Available Countries.
  2. Pass the amount and country code to this endpoint.
  3. Show the converted amount and rate to the customer before initiating a deposit.

Possible Errors

HTTP CodeError CodeMessage
400INVALID_INPUTOne or more required fields are missing.
401UNAUTHORIZEDInvalid or missing authentication credentials.
422VALIDATION_ERRORValidation failed for one or more fields.
500SERVER_ERRORAn unexpected error occurred.