const url = 'https://example.com/api/Transactions/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/refund';const options = { method: 'POST', headers: { 'Idempotency-Key': 'example', Authorization: 'Bearer <token>', 'Content-Type': 'application/json' }, body: '{"id":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","merchantId":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","amount":1,"reason":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/api/Transactions/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/refund \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --header 'Idempotency-Key: example' \ --data '{ "id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "merchantId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "amount": 1, "reason": "example" }'Issues a full or partial refund for an approved transaction. A new (negative-amount) refund transaction is created and the original is marked Refunded.
POST /api/transactions/{id}/refund
{
"amount": 12.50,
"reason": "Customer cancelled within trial"
}Authorizations
Section titled “Authorizations ”Parameters
Section titled “ Parameters ”Path Parameters
Section titled “Path Parameters ”The transaction’s identifier.
Header Parameters
Section titled “Header Parameters ”Required. A unique value (a UUID is ideal) per logical operation; reuse it when retrying that operation. A retry with the same key and body replays the original response instead of running twice. A 4xx frees the key, so the operation can be corrected and retried on it. A 5xx does not: the attempt may already have moved money, so retries with that key replay a problem+json saying the outcome is unknown, and a genuinely fresh attempt needs a new key. Missing → 400.
Request Body
Section titled “Request Body ”Refund payload.
object
Example generated
{ "id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "merchantId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "amount": 1, "reason": "example"}object
Example generated
{ "id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "merchantId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "amount": 1, "reason": "example"}object
Example generated
{ "id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "merchantId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "amount": 1, "reason": "example"}Responses
Section titled “ Responses ”Refund recorded.
object
Example
{ "status": "Processing"}Validation failed - check the errors object.
object
Example generated
{ "type": "example", "title": "example", "status": 1, "detail": "example", "instance": "example"}No transaction with the given ID exists.
object
Example generated
{ "type": "example", "title": "example", "status": 1, "detail": "example", "instance": "example"}The transaction can’t be refunded: it isn’t an approved charge, it never reached the gateway, or the amount exceeds what is still refundable.
object
Example generated
{ "type": "example", "title": "example", "status": 1, "detail": "example", "instance": "example"}The gateway declined the refund or could not confirm it. Nothing was recorded and the original charge is unchanged.
object
Example generated
{ "type": "example", "title": "example", "status": 1, "detail": "example", "instance": "example"}