Create a Refund
Creates a Refund resource.
Endpoint
POST /refunds
Sample code
- curl
- Node
- PHP
- Python
- Ruby
curl --request POST --location 'https://api.payrexhq.com/refunds' \
-u replace_with_secret_api_key: \
--data-urlencode 'amount=10000' \
--data-urlencode 'currency=PHP' \
--data-urlencode 'payment_id=<ID of a payment resource>' \
--data-urlencode 'reason=fraudulent' \
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',
});
$client = new \Payrex\PayrexClient('insert your PayRex Secret API key.');
$refund = $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'
]);
client = PayrexClient('insert your PayRex Secret API key.')
refund = 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'
}
)
client = Payrex::Client.new("insert your PayRex Secret API key.")
refund = client.refund.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.