Create full refund
You can create a full refund using the SDK below. For details on the request parameters, check the Create refund API.
node
const client = new MercadoPagoConfig({ accessToken: 'access_token', options: { timeout: 5000 } });
const refund = new PaymentRefund(client);
refund.create({
payment_id: '123456789',
body: {
amount: 100
}
}).then(console.log).catch(console.log);
Create partial refund
You can create a partial refund using the SDK below. For details on the request parameters, check the Create refund API.
node
var refund = {
payment_id: payment_id,
amount: 0.0
};
mercadopago.configure({
access_token: 'YOUR_ACCESS_TOKEN'
});
mercadopago.refund.create(refund).then((result) => {
console.log(result.response.id)
});
Get specific refund
You can get a specific refund of certain payments using the SDKs below. For details on the request parameters, check the Get specific refund API.
node
const client = new MercadoPagoConfig({ accessToken: 'access_token', options: { timeout: 5000 } });
const refund = new PaymentRefund(client);
refund.get({
payment_id: '<PAYMENT_ID>',
refund_id: '<REFUND_ID>'
}).then(console.log).catch(console.log);
Get refunds list
You can get all refunds for a specific payment using the SDK below. For details of the request parameters, access the API Get refunds list.
node
const client = new MercadoPagoConfig({ accessToken: 'access_token', options: { timeout: 5000 } });
const refund = new PaymentRefund(client);
refund.list({
payment_id: '<PAYMENT_ID>'
}).then(console.log).catch(console.log);