Links

Refunds

Paymongo Refunds

The Refund Resource

A Refund resource allows you to return full or partial amount of a payment to your customer's original payment method.

Creating a Refund

/**
* These are the required properties
* @param {string} secret API private key
* @param {Object} data Data payload
* @param {Object} data.attributes Payload attributes
* @param {number} data.attributes.amount Amount of the refund. A positive integer with minimum amount of 100. See https://developers.paymongo.com/reference/create-a-refund
* @param {string} data.attributes.notes Notes of the refund. You can use this value to save remarks about the refund. The maximum characters is 255.
* @param {string} data.attributes.payment_id The ID of a Payment resource to be refunded.
* @param {string} data.attributes.reason Reason for the refund. Possible values are duplicate, fraudulent, requested_by_customer and others.
* @param {Object} data.attributes.metadata A set of key-value pairs that you can attach to the resource. This can be useful for storing additional information about the object in a structured format. Only string values are accepted.
*/asc
const result = await paymongo.refunds.create(data);

Payload

{
"data": {
"id": "ref_vPSqdAPD2pmtKj6Ac5SRfXjs",
"type": "refund",
"attributes": {
"amount": 10000,
"currency": "PHP",
"livemode": true,
"notes": "Double payment created",
"payment_id": "pay_qOShdAuD3p8tKa6Ac4SRfbjs",
"payout_id": null,
"reason": "requested_by_customer",
"status": "succeeded",
"created_at": 1612746914,
"updated_at": 1612746914
}
}
}

Listing Refunds

const result = await paymongo.refunds.list();

Retrieving a Refund

/**
* @param {string} id ID of a Refund
*/
const result = await paymongo.refunds.retrieve(id);