跳转到主要内容

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.

只有在订单尚未到达终态时,你才能取消一个 Payment Intent。 一旦 Payment Intent 被取消,订单即关闭,客户将无法再完成该笔支付。

取消服务说明

项目详情
取消条件对于卡支付,仅当 Payment Intent 尚未到达终态时可取消。
对于钱包支付,当 Payment Intent 处于非终态时支持取消;对当天状态为 SUCCEEDED 的 PI 也可能支持取消(视渠道支持情况而定)。
完整 PI 状态列表请参考 PaymentIntent 状态参考
可取消金额仅支持按全额取消。

如何取消一笔支付

通过 API 取消

下例展示调用 Cancel a PaymentIntent endpoint 的请求和响应。

示例请求

curl --location 'https://api-sandbox.uqpaytech.com/api/v2/payment_intents/PI1961262700944166912/cancel' \
--header 'x-on-behalf-of;' \
--header 'x-idempotency-key: f20232c9-82b7-4ce5-a351-6718fc61a3d5' \
--header 'x-client-id: xcH5neaVpPAuN4yLfgCjGh' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'x-auth-token: Bearer your_bearer_token' \
--data '{
"cancellation_reason": "requested_by_customer"
}'

示例响应

{
  "amount": "0.01",
  "available_payment_method_types": null,
  "cancel_time": "",
  "cancellation_reason": "requested_by_customer",
  "captured_amount": "0.01",
  "client_secret": "eyJhb****XTg",
  "complete_time": "",
  "create_time": "2025-08-29T11:00:41+08:00",
  "currency": "SGD",
  "description": "wechat pay test",
  "intent_status": "REQUIRES_CUSTOMER_ACTION",
  "latest_payment_attempt": {
    "amount": "0.01",
    "attempt_id": "PA1961262701099356160",
    "attempt_status": "AUTHENTICATION_REDIRECTED",
    "captured_amount": "0.01",
    "complete_time": "",
    "create_time": "2025-08-29T11:00:41+08:00",
    "currency": "SGD",
    "failure_code": "",
    "refunded_amount": "0",
    "update_time": "2025-08-29T11:00:41+08:00"
  },
  "merchant_order_id": "04007403-a2f6-4531-97df-cdc8102f6713",
  "metadata": {
    "request_id": "b4fc2aea-5300-4ab8-bf48-4c0aa16cb5b7"
  },
  "next_action": {
    "display_qr_code": {
      "expires_at": "2025-08-29T11:30:41.061+08:00",
      "qr_code": "weixin://wxpay/bizpayurl?pr=1gEb7g3z1",
      "qr_code_url": "https://sg-acquiring-bucket-sandbox.s3.ap-southeast-1.amazonaws.com/payment/20250829/qrcode_PA1961262701099356160?X-Amz-Algorithm=AWS4-HMAC-SHA256\u0026X-Amz-Credential=ASIAY******f987429"
    }
  },
  "payment_intent_id": "PI1961262700944166912",
  "return_url": "https://paymentresultpage.com",
  "update_time": "2025-08-29T11:01:32+08:00"
}
你可以通过监听 acquiring.cancel.succeeded webhook,或主动调用 Retrieve a payment intent API 查询 Payment Intent 状态,来判断取消是否已成功处理。

通过控制台取消

在控制台中,点击订单旁的操作按钮,选择 Cancel