Este endpoint permite la cancelación de una compra para un pago específico, siempre que el estado del pago sea "in_process", "pending" o "authorized". En caso de éxito, la solicitud devolverá un código de estado 200.
PUT
REQUERIDO
REQUERIDO
REQUERIDO
400Error
2018
The action requested is not valid for the current payment state. Este error sucede cuando se intenta pasar a cancelado un payment cuyo status inicial no es "in_process", "pending" o authorized
2016
The action requested is not valid for the current payment state. Estado Inválido para Actualización. Este error ocurre cuando, por ejemplo, se intenta cambiar el estado de un pago de "in_process" a "approved". Esta solicitud solo acepta el estado "cancelled". Por favor, revise el parámetro enviado y realice una nueva solicitud con el valor correcto.
4017
Status attribute can't be null. Si este error aparece, revise el parámetro "status" para asegurarse de que esté establecido como "cancelled" y que no se haya dejado vacío. Confirme que el estado esté correctamente introducido antes de enviar una nueva solicitud.
401Error
5
Must provide your access token. Este error se muestra cuando se intenta realizar una solicitud sin enviar el Access Token. Verifique los parámetros de la solicitud y asegúrese de enviar la información necesaria.
Unauthorized
Invalid access token. Si este error aparece, por favor revise el Access Token proporcionado en su solicitud para asegurarse de que esté correcto. Después de verificar el token, envíe una nueva solicitud.
403Error
4
Forbidden. The caller is not authorized to access this resource. Este error ocurre al intentar cambiar el estado de un pago de "authorized" a "approved". El mismo problema surge al intentar cambiar el estado de un pago de "in_process" a "rejected" o "approved", o de "authorized" a "approved". En este caso, asegúrese de que el estado establecido sea estrictamente "cancelled" y envíe una nueva solicitud.
404Error
2000
Payment not found. Este error se devuelve cuando el ID de pago ingresado es incorrecto o no existe. Revise el parámetro "payment_id" y asegúrese de que el número ingresado sea correcto.
curl -X PUT \
'https://api.mercadopago.com/v1/payments/{payment_id}'\
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer APP_USR-4*********782856-12*********f202ca494*********f0baa4bb3*********648' \
-d '{
"status": "cancelled"
}'curl -X PUT \
'https://api.mercadopago.com/v1/payments/{payment_id}'\
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer APP_USR-4*********782856-12*********f202ca494*********f0baa4bb3*********648' \
-d '{
"status": "cancelled"
}'curl -X PUT \
'https://api.mercadopago.com/v1/payments/{payment_id}'\
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer APP_USR-4*********782856-12*********f202ca494*********f0baa4bb3*********648' \
-d '{
"status": "cancelled"
}'curl -X PUT \
'https://api.mercadopago.com/v1/payments/{payment_id}'\
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer APP_USR-4*********782856-12*********f202ca494*********f0baa4bb3*********648' \
-d '{
"status": "cancelled"
}'curl -X PUT \
'https://api.mercadopago.com/v1/payments/{payment_id}'\
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer APP_USR-4*********782856-12*********f202ca494*********f0baa4bb3*********648' \
-d '{
"status": "cancelled"
}'curl -X PUT \
'https://api.mercadopago.com/v1/payments/{payment_id}'\
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer APP_USR-4*********782856-12*********f202ca494*********f0baa4bb3*********648' \
-d '{
"status": "cancelled"
}'curl -X PUT \
'https://api.mercadopago.com/v1/payments/{payment_id}'\
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer APP_USR-4*********782856-12*********f202ca494*********f0baa4bb3*********648' \
-d '{
"status": "cancelled"
}'{
"id": 18746874919,
"date_created": "2021-12-10T17:13:23.000-04:00",
"date_approved": null,
"date_last_updated": "2021-12-10T17:31:34.000-04:00",
"date_of_expiration": "2021-12-13T22:59:59.000-04:00",
"money_release_date": null,
"operation_type": "regular_payment",
"issuer_id": null,
"payment_method_id": "bolbradesco",
"payment_type_id": "ticket",
"status": "cancelled",
"status_detail": "by_collector",
"currency_id": "BRL",
"description": "Meu produto",
"live_mode": null,
"sponsor_id": null,
"authorization_code": null,
"money_release_schema": null,
"taxes_amount": 0,
"counter_currency": null,
"brand_id": null,
"shipping_amount": 0,
"pos_id": null,
"store_id": null,
"integrator_id": null,
"platform_id": null,
"corporation_id": null,
"collector_id": null,
"payers": [
{
"first_name": null,
"last_name": null,
"email": "test@testuser.com",
"type": "collector",
"identification": [
{
"number": "32659430",
"type": "NIT"
}
],
"phone": [
{
"area_code": null,
"number": null,
"extension": null
}
],
"entity_type": null,
"id": "1003743392",
"operator_id": null
}
],
"marketplace_owner": null,
"metadata": [
{}
],
"additional_info": [
{
"items": [
{
"id": "234",
"title": {
"en": "My product.",
"pt": "Meu produto.",
"es": "Mi producto."
},
"description": {
"en": "E-commerce store cellphone.",
"pt": "Celular da loja online.",
"es": "Celular de la tienda online."
},
"picture_url": "https://www.mercadopago.com/org-img/MP3/home/logomp3.gif",
"category_id": "art",
"quantity": "1",
"unit_price": "75.76"
}
]
}
],
"order": [
{
"type": "mercadopago",
"id": "3754501423"
}
],
"external_reference": "firstname@gmail.com",
"transaction_amount": 75.76,
"transaction_amount_refunded": 0,
"coupon_amount": 0,
"differential_pricing_id": null,
"deduction_schema": null,
"barcode": [
{
"content": "23791883300000075763380250600221946300633330"
}
],
"installments": 1,
"transaction_details": [
{
"payment_method_reference_id": "6002219463",
"verification_code": "6002219463",
"net_received_amount": 0,
"total_paid_amount": 75.76,
"overpaid_amount": 0,
"external_resource_url": "https://www.mercadopago.com/mlb/payments/beta/ticket/helper?payment_id=18746874919&payment_method_reference_id=6002219463&caller_id=1003743392&hash=6a8c570f-9c39-4a5c-9b55-85ae1b724bf",
"installment_amount": 0,
"financial_institution": null,
"payable_deferral_period": null,
"acquirer_reference": null
}
],
"fee_details": [
{}
],
"charges_details": [
{}
],
"captured": true,
"binary_mode": true,
"call_for_authorize_id": null,
"statement_descriptor": null,
"card": [
{}
],
"notification_url": "https://webhook.site/17a3a5ce-28d4-4b4f-ba3f-a7595c17c6d8",
"refunds": [
{}
],
"processing_mode": "aggregator",
"merchant_account_id": null,
"merchant_number": null,
"acquirer_reconciliation": [
{}
],
"point_of_interaction": [
{
"type": "Unspecified",
"business_info": [
{
"unit": "online_payments",
"sub_unit": "checkout_pro"
}
]
}
]
}