The meCash Docs is live ๐ŸŽ‰ ๐ŸŽ‰
Quotes
Create Quote

Create Quote API Documentation

The Quote API allows users to generate a quote for a specified source and destination currency. It calculates and returns data based on rules associated with the transaction.

Endpoint

POST: Create a 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.

URL: https://{{baseURL}}/v1/quote


Request Headers

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

Request Body

{
   "paymentChannel": "WECHAT",
   "source": {
        "amount": 5000,
        "country": "NG",
        "currency": "NGN"
    },
    "target": {
        "country": "CN",
        "currency": "CNY"
    }
}

Request Parameters

FieldTypeDescriptionRequiredExample Value
paymentChannelStringPayment method for the transactionโœ… Yes"WECHAT" 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 --location --globoff 'https://{{baseURL}}/v1/quote' \
--header 'x-api-key: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
   "paymentChannel": "WECHAT",
   "source":{
        "amount": 5000,
        "country": "NG",
        "currency": "NGN"
    },
    "target":{
        "country": "CN",
        "currency": "CNY"
    }
}'

Try it out here!


Expected Responses

Success Response (200 OK)

If the request is successful, the API returns the following JSON response:

response.json
{
    "message": "quote successfully created",
    "status": "success",
    "data": {
        "id": "bb0a6d09-bf4c-45ef-b73b-6c378a672321",
        "source": {
            "currency": "NGN",
            "country": "NG",
            "amount": 5000.00
        },
        "target": {
            "currency": "CNY",
            "country": "CN",
            "amount": 22.77
        },
        "rate": 219.60300000,
        "fee": {
            "amount": 5.00
        },
        "rules": [
            {
                "category": "LIMIT",
                "appliedCurrency": "CNY",
                "appliedCountry": "CN",
                "transaction": {
                    "minimum": 10.00,
                    "maximum": 35000.00
                },
                "invoice": 35000.00
            }
        ],
        "summary": {
            "total": 5005.00
        }
    }
}

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.

Response Fields

FieldTypeDescription
messageStringAPI response message
statusStringSuccess or failure status
data.quoteIdStringUnique identifier for the quote
data.rateNumberExchange rate applied
data.source.amountNumberSource amount entered by user
data.source.currencyStringSource currency code
data.source.countryStringSource country code
data.target.amountNumberConverted target amount
data.target.currencyStringTarget currency code
data.target.countryStringTarget country code
data.fee.amountNumberTransaction fee applied
data.fee.currencyStringCurrency of the transaction fee
โ„น๏ธ

Note: Quote expires 10 minutes after it has been created.

Error Handling

Status CodeDescriptionExample Response
400 Bad RequestInvalid request parameters{ "message": "Invalid input data" }
401 UnauthorizedMissing or invalid API key{ "message": "Unauthorized access" }
422 Unprocessable EntityBusiness rule validation failed{ "message": "Invalid source or target currency" }
500 Internal Server ErrorUnexpected server issue{ "message": "An internal error occurred" }

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.