Skip to Content
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.

Test mode

With a test API key, some values make this endpoint succeed, fail or wait. See the test mode values for this endpoint.

POST
/v1/refunds

Authorization

authorization
headerAuthorizationBearer <SECRET_API_KEY>

Set Your Secret API Key

Header Parameters

Idempotency-Key?string

A unique value, eg. a UUID.

Request Body

application/json
amount*number

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

Range 1 <= 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).
Length 1 <= length

Response Body

OK

*/*
amount?integer

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

Format int64
createdAt?string

Time at which the object was created. In ISO 8601 format.

currency?string

Three-letter ISO 4217 currency code in full uppercase.

id?string

Unique identifier for the object.

resultCode?string

Additional information when status is FAILED, if available. Possible values: TRANSACTION_NO_LONGER_REFUNDABLE, OTHERS.

status?string

Status of the refund. One of PENDING, SUCCEEDED, or FAILED.

transactionId?string

ID of transaction to refund.

updatedAt?string

Time at which the object was last updated. In ISO 8601 format.

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