Skip to main content
POST
/
v2
/
payment
/
refunds
Create a refund
curl --request POST \
  --url https://api-sandbox.uqpaytech.com/api/v2/payment/refunds \
  --header 'Content-Type: application/json' \
  --header 'x-auth-token: <api-key>' \
  --header 'x-client-id: <x-client-id>' \
  --header 'x-idempotency-key: <x-idempotency-key>' \
  --data '
{
  "payment_intent_id": "PI1234567890123456789",
  "amount": "10.01",
  "reason": "Return good",
  "payment_attempt_id": "PA1234567890123456789",
  "metadata": {
    "customer_id": "cust_12345",
    "order_id": "order_6789"
  }
}
'
{
  "payment_refund_id": "RF123456789",
  "payment_attempt_id": "PA123456789",
  "amount": "10.01",
  "currency": "USD",
  "refund_status": "SUCCEEDED",
  "create_time": "2024-03-01T00:00:00+08:00",
  "update_time": "2024-03-01T00:00:00+08:00",
  "reason": "Order 1234 has been returned",
  "metadata": {
    "customer_id": "cust_12345",
    "order_id": "order_6789"
  }
}

Authorizations

x-auth-token
string
header
required

The API token for login provided by UQPay.

Headers

x-client-id
string
required

The API client id generated by UQPAY

x-on-behalf-of
string

Specifies the sub-account on whose behalf the request is made. This should be set to the account_id, which can be retrieved via the List Connected Accounts. If omitted or empty, the request is executed using the master account. More information at Connected Accounts.

x-idempotency-key
string<uuid>
required

A unique identifier (UUID) used to maintain operation idempotency, ensuring that repeated executions of the same operation do not result in unintended effects or duplication. It helps preserve data consistency in the face of network errors, retries, or failures.

Body

application/json
payment_intent_id
string
required

The ID of the payment intent to refund

Maximum string length: 36
Example:

"PI1234567890123456789"

amount
string
required

The amount to refund

Example:

"10.01"

reason
string
required

The reason for the refund

Maximum string length: 100
Example:

"Return good"

payment_attempt_id
string

The ID of the payment attempt to refund

Example:

"PA1234567890123456789"

metadata
object

Additional metadata for the refund

Example:
{
"customer_id": "cust_12345",
"order_id": "order_6789"
}

Response

Refund created successfully

payment_refund_id
string

The unique identifier for the refund

Example:

"RF123456789"

payment_attempt_id
string

The ID of the payment attempt that was refunded

Example:

"PA123456789"

amount
string

The amount refunded

Example:

"10.01"

currency
string<iso-4217>

The three-letter currency code (ISO 4217)

Example:

"USD"

refund_status
enum<string>

The current status of the refund

Available options:
INITIATED,
PROCESSING,
SUCCEEDED,
FAILED,
REVERSAL_INITIATED,
REVERSAL_PROCESSING,
REVERSAL_SUCCEEDED
Example:

"SUCCEEDED"

create_time
string<date/time>

The time at which this payment refund was created.

Example:

"2024-03-01T00:00:00+08:00"

update_time
string<date/time>

Last time at which this payment refund was updated or operated on.

Example:

"2024-03-01T00:00:00+08:00"

reason
string

The reason for the refund

Maximum string length: 100
Example:

"Order 1234 has been returned"

metadata
object

Additional metadata associated with the refund. User-defined key-value pairs.

Example:
{
"customer_id": "cust_12345",
"order_id": "order_6789"
}