Home
Documentation
Resources
Partners
Community

Resources

Check for updates on our solutions and system performance, or request technical support.

Partners

Discover our program for agencies or developers that offer integration services and sellers who want to hire them.

Community

Get the latest news, ask others for help and share your knowledge.

Cancel order by ID - In person payments - Mercado Pago Developers

Intelligent search powered by OpenAI 

Cancel order by ID

POST

https://api.mercadopago.com/v1/orders/{order_id}/cancel
Cancel an order created for Mercado Pago Point and 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.
Request's parameters
PATH
order_id
string

REQUIRED

ID of the order that is being cancelled. This value is returned in the response to the Create order request.
HEADER
X-Idempotency-Key
string

REQUIRED

This feature allows you to safely retry requests without the risk of accidentally performing the same action more than once. This is useful for avoiding errors, such as creating two identical payments. To ensure that eac...View more
Response parameters
id
string
Identifier of the order cancelled in the request.
type
string
Order type.
point: Order created for Mercado Pago Point payments.
external_reference
string
It is the external reference of the order, assigned when creating it. he maximum allowed limit is 64 characters, and the allowed characters are: uppercase and lowercase letters, numbers, and the symbols hyphen (-) and un...View more
description
string
Description of the purchased product, the reason for the payment order.
Errors

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 is not correct. 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

Order not found. Please check if you provided the correct order ID.

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.

cannot_cancel_order

There is a conflict trying to cancel the order due to its current status. Please note that orders can only be cancelled via API when "status=created". If you are trying to cancel an order with status "status=at_terminal", you will need to do from the terminal.

500Error.

idempotency_validation_failed

Validation fail. Please try submitting the request again.

500

Internal server error. Please try submitting the request again.

Request
curl -X POST \
    'https://api.mercadopago.com/v1/orders/{order_id}/cancel'\
    -H 'Content-Type: application/json' \
       -H 'X-Idempotency-Key: 0d5020ed-1af6-469c-ae06-c3bec19954bb' \
       -H 'Authorization: Bearer TEST-8971*********918-01191*********5874530a4*********4799fdf-1*********' \
    
Sample answer
{
  "id": "123",
  "type": "point",
  "external_reference": "ext_ref_1234",
  "description": "Point Smart Mini",
  "site_id": "MLB",
  "integration_data": {
    "application_id": 1234567890,
    "platform_id": "1234567890",
    "integrator_id": "1234567890",
    "sponsor": {
      "id": "446566691"
    }
  },
  "status": "cancelled",
  "created_date": "2024-09-10T14:26:42.109320977Z",
  "last_updated_date": "2024-09-10T14:26:42.109320977Z",
  "type_config": {
    "terminal_id": "PAX_A910__SMARTPOS1423",
    "ticket_number": "S0392JED",
    "flow_process": "credit_card"
  },
  "transactions": {
    "payments": [
      {
        "id": "pay_01J67CQQH5904WDBVZEM4JMEP3",
        "amount": "24.90",
        "status": "cancelled",
        "status_detail": "cancelled_by_api"
      }
    ]
  }
}