Skip to main content

Common Error Handling in the API

API error responses use a uniform format for all operations. Whenever data validation fails (for example, when an order amount is outside the allowed limits), you will receive an HTTP 400 response with structured details in an errors array.

Error Response Structure

{
"type": "<error type>",
"errors": [
{
"attr": "<field>",
"code": "<error code>",
"detail": "<specific error message>"
}
]
}
  • attr: Name of the field that generated the validation error.
  • code: Type of error (for example, "invalid" for an incorrect value).
  • detail: Human-readable message explaining the reason.

Example: Amount Outside Established Limits

Attempting to create an order with a very low amount

curl -X POST https://api.dev.pago46.io/api/v1/merchants/orders/pay-in/ \
-H "Merchant-Key: <YOUR_MERCHANT_KEY>" \
-H "Message-Date: <TIMESTAMP>" \
-H "Message-Hash: <HMAC_SIGNATURE>" \
-H "Content-Type: application/json" \
-d '{
"order_type": "LocalCurrencyOrder",
"country": "MX",
"price": "1.00",
"price_currency": "MXN"
// ...other required fields
}'

Response:

{
"type": "validation_error",
"errors": [
{
"attr": "price",
"code": "invalid",
"detail": "Value is too low."
}
]
}

Attempting to create an order with a very high amount

curl -X POST https://api.dev.pago46.io/api/v1/merchants/orders/pay-in/ \
-H "Merchant-Key: <YOUR_MERCHANT_KEY>" \
-H "Message-Date: <TIMESTAMP>" \
-H "Message-Hash: <HMAC_SIGNATURE>" \
-H "Content-Type: application/json" \
-d '{
"order_type": "LocalCurrencyOrder",
"country": "MX",
"price": "10000000000.00",
"price_currency": "MXN"
// ...other required fields
}'
{
"type": "validation_error",
"errors": [
{
"attr": "price",
"code": "invalid",
"detail": "Value is too high."
}
]
}
Operational Limits

The minimum and maximum amount values accepted for each merchant may vary according to the commercial agreement and other factors (country, currency). If you have questions about your current operating parameters, please contact your Pago46 representative.

This format applies to both pay-in and pay-out operations, as well as other business validations.