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.
const client = new MercadoPago({ accessToken: 'ACCESS_TOKEN' });
const payments = new Payments(client);
payments.cancel('123456789', { idempotencyKey: '<SOME_UNIQUE_VALUE>' })
.then((result) => { console.log(result); })
.catch((error) => { console.error(error); });