> ## Documentation Index
> Fetch the complete documentation index at: https://developers-sandbox.uqpaytech.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# 取消支付

> 在 Payment Intent 到达终态前取消该支付，适用于卡支付和钱包支付。

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

## 取消服务说明

| 项目 | 详情 |
| - | - |
| **取消条件** | 对于**卡支付**，仅当 Payment Intent 尚未到达终态时可取消。 对于**钱包支付**，当 Payment Intent 处于非终态时支持取消；对当天状态为 **SUCCEEDED** 的 PI 也可能支持取消（视渠道支持情况而定）。 完整 PI 状态列表请参考 [PaymentIntent 状态参考](https://developers-sandbox.uqpaytech.com/docs/zh/global-acquiring/v1.6/guide/core-concepts.md) |
| **可取消金额** | 仅支持按全额取消。 |

## 如何取消一笔支付

### 通过 API 取消

下例展示调用 [Cancel a PaymentIntent](https://developers-sandbox.uqpaytech.com/docs/zh/global-acquiring/v1.6/api-reference/cancel-payment-intent.md) endpoint 的请求和响应。

#### 示例请求

```shell theme={null}
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: your_client_id' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'x-auth-token: Bearer your_bearer_token' \
--data '{
"cancellation_reason": "requested_by_customer"
}'
```

#### 示例响应

```json theme={null}
{
  "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",
    "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**](https://developers-sandbox.uqpaytech.com/docs/zh/global-acquiring/v1.6/api-reference/retrieve-payment-intent.md) API 查询 Payment Intent 状态，来判断取消是否已成功处理。

### 通过控制台取消

1. 在商户后台打开 **Payments** → **Transactions**。
2. 打开符合条件的支付，或使用其行操作菜单，然后选择 **Cancel**。
3. 检查确认信息并确认取消。

只有支付仍可取消且当前角色拥有取消权限时，Cancel 操作才会显示。请通过取消 Webhook 或 Retrieve a payment intent API 确认最终结果。

## 预授权撤销

预授权仅在尚未请款、未过期，且渠道支持撤销时允许商户撤销。请款处理中或已发生请款时，不要提交撤销；剩余授权额度由系统处理。`available_to_void`大于零不代表一定符合撤销条件。参见[预授权与手动请款](https://developers-sandbox.uqpaytech.com/docs/zh/global-acquiring/v1.6/guide/direct-api-integration.md#pre-authorization-and-manual-capture)。


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.