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-ratesAuthentication:
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/jsonAccept: application/jsonIdempotency-Key: <uuid-v4>Request Parameters
| Field | Type | Required | Description |
|---|---|---|---|
country | string | Yes | ISO 3-letter country code obtained from Get Available Countries. |
amount | number | Yes | Deposit amount in the original currency. |
Example cURL Request
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
| Field | Type | Description |
|---|---|---|
success | boolean | Indicates if the request was successful. |
data.country | string | Country code used for the conversion. |
data.amount | number | Original amount provided in the request. |
exchange_rates.fx_rate | number | Conversion rate applied. |
exchange_rates.currency | string | Target currency code. |
exchange_rates.converted_amount | number | Converted amount after applying the exchange rate. |
Common Use Case
- Select a country from Get Available Countries.
- Pass the amount and country code to this endpoint.
- Show the converted amount and rate to the customer before initiating a deposit.
Possible Errors
| HTTP Code | Error Code | Message |
|---|---|---|
| 400 | INVALID_INPUT | One or more required fields are missing. |
| 401 | UNAUTHORIZED | Invalid or missing authentication credentials. |
| 422 | VALIDATION_ERROR | Validation failed for one or more fields. |
| 500 | SERVER_ERROR | An unexpected error occurred. |