The meCash Docs is live πŸŽ‰ πŸŽ‰
Quotes
Update Quote

Update Quote API Documentation

The Update Quote API allows users to modify an existing currency exchange quote. This is useful when users need to adjust transaction details such as payment channel, source amount, and target currency before finalizing the exchange.


Endpoint

PUT https://{{baseURL}}/v1/quote/{{quote_id}}

Path Parameter

ParameterTypeDescriptionRequired
quote_idStringUnique identifier of the quote to be updatedβœ… Yes

Headers

HeaderDescriptionRequiredExample Value
x-api-keyAPI key for authenticationβœ… YesAPI_KEY
Content-TypeSpecifies JSON format for the bodyβœ… Yesapplication/json

Request Body

The request body should contain the updated details for the quote.

Example Request

{
   "paymentChannel": "WECHAT",
   "source": {
       "amount": 0,
       "country": "",
       "currency": ""
   },
   "target": {
       "amount": 0,
       "country": "",
       "currency": ""
   }
}

**Request Parameters Explanation **

FieldTypeDescriptionRequired
paymentChannelStringPayment method for the transactionβœ… Yes
source.amountNumberUpdated amount in the source currencyβœ… Yes
source.countryStringSource country code (ISO 3166-1 alpha-2)βœ… Yes
source.currencyStringSource currency code (ISO 4217)βœ… Yes
target.amountNumberUpdated amount in the target currencyβœ… Yes
target.countryStringTarget country codeβœ… Yes
target.currencyStringTarget currency codeβœ… Yes

Example cURL Request

curl --location --request PUT 'https://{{baseURL}}/v1/quote/{{quote_id}}' \
--header 'x-api-key: API_KEY' \
--header 'Content-Type: application/json' \
--data '{
   "paymentChannel": "WECHAT",
   "source": {
       "amount": 10000,
       "country": "NG",
       "currency": "NGN"
   },
   "target": {
       "amount": 45.5,
       "country": "US",
       "currency": "USD"
   }
}'

Success Response (200 OK)

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

response.json
{
    "message": "quote successfully updated",
    "status": "success",
    "data": {
        "id": "90b8cb00-5fc2-4a01-87fc-558f4bd53231",
        "source": {
            "currency": "NGN",
            "country": "NG",
            "amount": 10000.00
        },
        "target": {
            "currency": "USD",
            "country": "US",
            "amount": 45.50
        },
        "rate": 220.00,
        "fee": {
            "amount": 15.00
        },
        "rules": [
            {
                "category": "LIMIT",
                "appliedCurrency": "USD",
                "appliedCountry": "US",
                "transaction": {
                    "minimum": 5.00,
                    "maximum": 50000.00
                },
                  "invoice": 50000.00
            }
        ],
        "summary": {
            "total": 10015.00
        }
    }
}

Error Handling

Status CodeMeaningExample Response
400Bad Request{ "message": "Invalid parameters" }
401Unauthorized{ "message": "Invalid API key" }
422Unprocessable Entity{ "message": "Invalid currency code" }
500Internal Server Error{ "message": "An internal error occurred" }

Key Takeaways

  • βœ… The user modifies an existing quote by updating the amount, source, and target details.
  • βœ… The response returns the updated exchange rate, transaction fee, and total payable amount.
  • βœ… A transaction limit rule ensures transactions remain within 5 USD – 50,000 USD.

Best Practices

  • βœ… Ensure the quote_id is retrieved from the Create Quote API before making the update request.
  • βœ… Validate that the updated source and target currency codes are correct.
  • βœ… Implement error handling for common status codes such as: