Quotes
Create Quote

Create Quote API

The Create Quote API allows users to generate a quote for a specified source and destination currency.

Endpoint

POST : {{baseURL}}/v1/quote

Description

This endpoint creates a currency exchange quote for a user, considering applicable business rules. The response includes the converted amount, exchange rate, fees, and transaction limits.


Request Headers

HeaderDescriptionRequiredExample Value
x-api-keyAPI key for authentication✅ YesAPI_KEY_HERE
Content-TypeRequest content type✅ Yesapplication/json

Request Body

{
  "paymentChannel": " ",  // Payment method for the transaction
  "source": {
    "amount": ,          // Amount in the source currency
    "country": " ",           // Source country code (ISO 3166-1 alpha-2)
    "currency": " "          // Source currency code (ISO 4217)
  },
  "target": {
    "country": " ",           // Target country code (ISO 3166-1 alpha-2)
    "currency": " "          // Target currency code (ISO 4217)
  }
}

Request Parameters

FieldTypeDescriptionRequiredExample Value
paymentChannelStringPayment method for the transaction✅ Yes"BANK_TRANSFER" or "ALI_PAY"
source.amountNumberAmount in the source currency✅ Yes5000
source.countryStringSource country code (ISO 3166-1 alpha-2)✅ Yes"NG"
source.currencyStringSource currency code (ISO 4217)✅ Yes"NGN"
target.countryStringTarget country code✅ Yes"CN"
target.currencyStringTarget currency code✅ Yes"CNY"

Example Request

cURL

curl --location --globoff '{{baseURL}}/v1/quote' \
--header 'x-api-key: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
  "paymentChannel": "",
  "source": {
    "amount": 150000,
    "country": "NG",
    "currency": "NGN"
  },
  "target": {
    "country": "CN",
    "currency": "CNY"
  }
}'

Responses

response.json
{
  "message": "quote successfully created",
  "status": "success",
  "data": {
    "id": "e5eec724-38f9-40e2-9i86-xxxxxxxxxxxxx",
    "source": {
      "currency": "NGN",
      "country": "NG",
      "amount": 150000.00
    },
    "target": {
      "currency": "CNY",
      "country": "CN",
      "amount": 81.97
    },
    "rate": 1830.00000000,
    "fee": {
      "amount": 0.00
    },
    "rules": [
      {
        "category": "LIMIT",
        "appliedCurrency": "CNY",
        "appliedCountry": "CN",
        "transaction": {
          "minimum": 1.00,
          "maximum": 20000000000000.00
        },
        "invoice": 200000000000.00
      }
    ],
    "summary": {
      "total": 150000.00
    },
    "expiresInSeconds": 600
  }
}
ℹ️

Note: Every quote expires 10 minutes after it has been created.

Response Breakdown

General Information

FieldTypeDescription
messageStringConfirmation message
statusStringIndicates success or failure
data.idStringUnique identifier for the quote

Source (Sending) Details

FieldTypeDescription
source.currencyStringCurrency being exchanged
source.countryStringCountry where the transaction originates
source.amountNumberAmount to be converted

Target (Receiving) Details

FieldTypeDescription
target.currencyStringTarget currency
target.countryStringDestination country
target.amountNumberConverted amount

Exchange Rate and Fees

FieldTypeDescription
rateNumberExchange rate applied
fee.amountNumberTransaction fee

Transaction Rules

FieldTypeDescription
rules[].categoryStringType of rule applied
rules[].appliedCurrencyStringCurrency the rule applies to
rules[].appliedCountryStringCountry the rule applies to
rules[].transaction.minimumNumberMinimum allowed transaction
rules[].transaction.maximumNumberMaximum allowed transaction
rules[].invoiceNumberMaximum invoice amount

Summary

FieldTypeDescription
summary.totalNumberTotal amount user pays

Expiration

FieldTypeDescription
expiresInSecondsNumberQuote expiration time in seconds

Note:

  • Make sure to save the quote Id, it will be required for payouts
  • The exchange rate is dynamic and subject to change.
  • The fee and category parameters are preset in the meCash configuration.
  • Transaction limits (minimum/maximum amounts) are predefined in the system.

Error Handling

Status CodeMeaningExample ResponseHow to Handle
400Bad Request (No API Key)No API key found in requestEnsure x-api-key header is sent with a valid key
400Route Not FoundThe Route is not supportedContact support to get the correct route
400Validation ErrorRequired field missing or invalid requestCheck API documentation for required fields and input formats
401Unauthorized (Invalid API Key)Invalid authentication credentialsVerify API key in the header is correct and active in dashboard settings
403Forbidden (Non-whitelisted IP)Your IP address is not allowed to access this serviceWhitelist your IP address in the API Management settings on the dashboard
422Unprocessable Entity (Semantic Error)Invalid value in request bodyReview request body for semantic errors (e.g., invalid values or logic errors)
429Too Many Requests (Rate Limited)API rate limit exceedImplement retry with exponential backoff; respect rate limits (e.g., 50 requests/sec)
500Internal Server ErrorAn unexpected error occurred on the serverRetry after some time; if persistent, contact support

Best Practices

  • ✅ Always include a valid x-api-key in the request header.
  • ✅ Ensure that the source and target country and currency values are valid.