Cancel an order created for Mercado Pago QR Code and all its transactions using the reference ID obtained in the response to its creation. Only an order in "status=created" can be canceled. In case of success, the request will return a response with status 200.
POST
REQUIRED
REQUIRED
REQUIRED
400Error.
empty_required_header
The "X-Idempotency-Key" header is required and was not sent. Make the requisition again including it.
invalid_path_param
The "order_id" provided in the request path has has an invalid format. It must begin with the prefix "ORD" and be followed by 26 characters. Please confirm it and provide a valid ID to try again.
401Error.
unauthorized
The value sent as Access Token is incorrect. Please check and try again with the correct value.
404Error.
order_not_found
The value sent as Order ID does not correspond to a created order, therefore it could not be found. Please check and try again with the correct value.
409Error.
idempotency_key_already_used
The value sent as the idempotency header has already been used. Please try the request again sending a new value.
order_already_canceled
There is a conflict trying to cancel the order due to its current status. Please note that orders can only be canceled via API when "status=created".
instore_order_locked_error
Cannot cancel an order while payment is in progress. Please note that orders can only be canceled via API when "status=created".
500Error.
500
Internal server error. Please try submitting the request again.
curl -X POST \
'https://api.mercadopago.com/v1/orders/{order_id}/cancel'\
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer APP_USR-8*********88776-122*********fc20dede6*********a497d7225*********64' \
-H 'X-Idempotency-Key: 5456eb4e-332e-4a77-b823-6959441fb84e' \
{
"id": "ORD00001111222233334444555566",
"user_id": "5238400195",
"type": "qr",
"external_reference": "ext_ref_1234",
"description": "Smartphone",
"expiration_time": "PT16M",
"processing_mode": "automatic",
"total_amount": "50.00",
"country_code": "BR",
"marketplace_fee": "11.20",
"integration_data": {
"application_id": "1234567890",
"platform_id": "dev_1234567890",
"integrator_id": "dev_1234",
"sponsor": {
"id": "446566691"
}
},
"status": "canceled",
"status_detail": "canceled",
"currency": "BRL",
"created_date": "2024-09-10T14:26:42.109320977Z",
"last_updated_date": "2024-09-10T14:26:42.109320977Z",
"config": {
"qr": {
"external_pos_id": "EXTERNALPOS019285",
"mode": "static"
}
},
"transactions": {
"payments": [
{
"id": "PAY01J67CQQH5904WDBVZEM4JMEP3",
"amount": "24.50",
"status": "canceled",
"status_detail": "canceled_by_api"
}
]
},
"items": [
{
"title": "Smartphone",
"unit_price": "24.50",
"quantity": 1,
"unit_measure": "kg",
"external_code": "777489134",
"external_categories": [
{
"id": "food"
}
]
}
],
"discounts": {
"payment_methods": [
{
"new_total_amount": "47.28",
"type": "account_money"
}
]
}
}