Skip to main content
POST
/
s2s
/
payments
/
refund
cURL
curl --request POST \
  --url https://api.xpaycheckout.com/s2s/payments/refund \
  --header 'Authorization: Basic <encoded-value>' \
  --header 'Content-Type: application/json' \
  --data '{
  "payment_id": "pay_8Ks3Jq1tZxPjYVhRQW2r5",
  "amount": 10000,
  "reason": "Customer requested refund",
  "metadata": {
    "refund_reason_code": "customer_request"
  }
}'
{
  "payment_id": "pay_8Ks3Jq1tZxPjYVhRQW2r5",
  "status": "REFUNDED",
  "transaction_id": "txn_9Ls4Kp2uAxQkZWiSRX3s6",
  "amount": 10000,
  "currency": "USD",
  "refunded_amount": 10000,
  "receiptId": "receipt_abc123",
  "channel": "web",
  "reason": "Customer requested refund",
  "refunded_at": 1728128400000
}
Initiates a refund for a completed transaction. The payment status will change to REFUNDED or PARTIALLY_REFUNDED accordingly.

Authorizations

Authorization
string
header
required

Basic authentication header of the form Basic <encoded-value>, where <encoded-value> is the base64-encoded string username:password.

Body

application/json

Trigger Refund Request

payment_id
string
required

Unique payment identifier

Example:

"pay_8Ks3Jq1tZxPjYVhRQW2r5"

amount
integer

Amount to refund in smallest unit. If omitted, full amount is refunded

Example:

10000

reason
string

Reason for refund

Example:

"Customer requested refund"

metadata
object

Additional key-value pairs

Example:
{ "refund_reason_code": "customer_request" }

Response

Refund processed successfully

payment_id
string
Example:

"pay_8Ks3Jq1tZxPjYVhRQW2r5"

status
enum<string>
Available options:
REFUNDED,
PARTIALLY_REFUNDED
Example:

"REFUNDED"

transaction_id
string
Example:

"txn_9Ls4Kp2uAxQkZWiSRX3s6"

amount
integer
Example:

10000

currency
string
Example:

"USD"

refunded_amount
integer
Example:

10000

receiptId
string
Example:

"receipt_abc123"

channel
string
Example:

"web"

reason
string
Example:

"Customer requested refund"

refunded_at
integer

Epoch timestamp in milliseconds of when refund was processed

Example:

1728128400000