Cancellations - Python - Mercado Pago Developers

Create cancellation

It is possible to cancel a specific purchase from the payment ID using the SDK below. For details on request parameters, check the Cancellation API.

          
sdk = mercadopago.SDK("ENV_ACCESS_TOKEN")
 
payment_data = {
   "status": "cancelled"
}
 
payment_response = sdk.payment().update(payment_id, payment_data)
payment = payment_response["response"]