Payments & Fund TransfersRefunds

Create a Refund

Create a refund for a payment.

This is an asynchronous operation. The status of the Refund object in a successful response will be PENDING. Listen to the refunds.succeeded or refunds.failed webhook to be notified of the final outcome of the refund.

POST
/v1/refunds

Authorization

authorization
AuthorizationBearer <token>

Set Your Secret API Key

In: header

Header Parameters

Idempotency-Key?string

A unique value, eg. a UUID.

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

amount*number

A positive integer value in the specified currency's smallest unit. e.g. $10 would be represented as 1000 (cents).

Range1 <= value <= 20000000
currency*string

Three-letter ISO 4217 currency code in full uppercase. Must be a supported currency.

transactionId*string

ID of transaction to refund.

Use these transaction IDs in test mode to simulate various outcomes:

  • txn_SuccessfulRefund: Create a successful refund. The status will change from PENDING to SUCCEEDED after a short while.
  • txn_FailedRefund: Create a failed refund. The status will change from PENDING to FAILED after a short while.
  • txn_InvalidTransaction: Simulate attempting to refund a transaction that cannot be refunded.
  • txn_AlreadyRefunded: Simulate attempting to refund a transaction that has already been refunded.
  • txn_RejectOverRefund: Simulate attempting to refund an amount that is greater than the transaction's refundable amount.
  • txn_NoLongerRefundable: Simulate attempting to refund a transaction that is no longer refundable (e.g. exceeded refund window).
Length1 <= length

Response Body

*/*

application/json

application/json

curl -X POST "https://example.com/v1/refunds" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 1,
    "currency": "string",
    "transactionId": "string"
  }'
{
  "amount": 0,
  "createdAt": "string",
  "currency": "string",
  "id": "string",
  "resultCode": "string",
  "status": "string",
  "transactionId": "string",
  "updatedAt": "string"
}