跳转到主要内容
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"
  }
}

Documentation Index

Fetch the complete documentation index at: https://developers-sandbox.uqpaytech.com/llms.txt

Use this file to discover all available pages before exploring further.

授权

x-auth-token
string
header
必填

The API token for login provided by UQPay.

请求头

x-client-id
string
必填

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>
必填

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.

请求体

application/json
payment_intent_id
string
必填

The ID of the payment intent to refund

Maximum string length: 36
示例:

"PI1234567890123456789"

amount
string
必填

The amount to refund

示例:

"10.01"

reason
string
必填

The reason for the refund

Maximum string length: 100
示例:

"Return good"

payment_attempt_id
string

The ID of the payment attempt to refund

示例:

"PA1234567890123456789"

metadata
object

Additional metadata for the refund

示例:
{
"customer_id": "cust_12345",
"order_id": "order_6789"
}

响应

200 - application/json

Refund created successfully

payment_refund_id
string

The unique identifier for the refund

示例:

"RF123456789"

payment_attempt_id
string

The ID of the payment attempt that was refunded

示例:

"PA123456789"

amount
string

The amount refunded

示例:

"10.01"

currency
string<iso-4217>

The three-letter currency code (ISO 4217)

示例:

"USD"

refund_status
enum<string>

The current status of the refund

可用选项:
INITIATED,
PROCESSING,
SUCCEEDED,
FAILED,
REVERSAL_INITIATED,
REVERSAL_PROCESSING,
REVERSAL_SUCCEEDED
示例:

"SUCCEEDED"

create_time
string<date/time>

The time at which this payment refund was created.

示例:

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

update_time
string<date/time>

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

示例:

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

reason
string

The reason for the refund

Maximum string length: 100
示例:

"Order 1234 has been returned"

metadata
object

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

示例:
{
"customer_id": "cust_12345",
"order_id": "order_6789"
}