Skip to main content

Create a Refund

Creates a Refund resource.


Endpoint

POST /refunds

Sample code

const client = require('payrex-node')('insert your PayRex Secret API key.');

const refund = await client.refunds.create({
// Amount is in cents. The sample below is 100.00.
amount: 10000,
currency: 'PHP',
payment_id: '<ID of a payment resource>',
reason: 'fraudulent',
});

Parameters

amount REQUIRED

The amount to be refunded. You can specify the full amount of the Payment or just partial amount.


currency REQUIRED

A three-letter ISO currency code in uppercase. As of the moment, we only support PHP.


description optional

An arbitrary string attached to the Refund.


remarks optional

Remarks about the refund.


reason REQUIRED

The reason of the Refund. Possible values are fraudulent, requested_by_customer, product_out_of_stock, service_not_provided, product_was_damaged, service_misaligned, wrong_product_received, or others.

You can use the remarks attribute to add remarks if the value of the reason is others.


metadata optional

A set of key-value pairs you can attach to the Refund. This can be useful for storing additional information about the Refund in a hash format.

Returns

Returns a Refund resource.