# 预授权请款与撤销

> 对成功的预授权发起全额请款，或撤销预授权以释放冻结金额。

```yaml
openapi: 3.1.0
info:
  title: 预授权请款与撤销
  version: 1.0.0
  description: 对成功的预授权发起全额请款，或撤销预授权以释放冻结金额。
paths:
  /v1/txn/authPayment:
    post:
      summary: 预授权请款与撤销
      description: 对成功的预授权发起全额请款，或撤销预授权以释放冻结金额。
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                merchantNo:
                  type: string
                  description: Onerway 分配的商户号；获取方式参见[接入准备](/zh/payments/get-started/setup#获取凭证)。
                txnType:
                  type: string
                  description: 要执行的授权后操作类型，决定本次调用是请款还是撤销。
                  enum:
                    - CAPTURE
                    - VOID
                  x-enum-descriptions:
                    CAPTURE: 预授权请款：对此前成功的预授权发起请款，扣划已冻结的全部金额；仅支持全额请款。
                    VOID: 预授权撤销：撤销此前的预授权，释放冻结金额、不扣款。
                merchantTxnId:
                  type: string
                  description: 本次请款 / 撤销操作的商户交易订单号；不同订单号视为不同交易。
                originTransactionId:
                  type: string
                  description: 原预授权交易订单号（Onerway 侧返回的交易号），用于定位被请款 / 撤销的预授权交易。
                sign:
                  type: string
                  description: 请求签名字符串；生成方式详见[请求签名](/zh/payments/get-started/request-signing)。
              required:
                - merchantNo
                - txnType
                - originTransactionId
                - sign
            examples:
              capture-authorization:
                summary: 预授权请款
                value:
                  merchantNo: replace_with_merchant_no
                  merchantTxnId: txn_demo_capture_202606210001
                  originTransactionId: example_original_auth_transaction_id
                  sign: "{{SIGN}}"
                  txnType: CAPTURE
              void-authorization:
                summary: 预授权撤销
                value:
                  merchantNo: replace_with_merchant_no
                  merchantTxnId: txn_demo_void_202606210001
                  originTransactionId: example_original_auth_transaction_id
                  sign: "{{SIGN}}"
                  txnType: VOID
      responses:
        "200":
          description: Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  respCode:
                    type: string
                    description: 响应码；`20000`
                      表示请求处理成功，其余为错误码。完整码表见[响应码](/zh/payments/api-reference/response-codes)。
                  respMsg:
                    type: string
                    description: 响应码对应的可读消息。
                  data:
                    type: object
                    properties:
                      transactionId:
                        type: string
                        description: Onerway 为本次请款 / 撤销操作生成的交易号，用于跟踪与查询；不要与请求中的
                          `originTransactionId`（原预授权交易号）混用。
                      paymentId:
                        type: string
                        description: 支付意图 ID，用于关联原预授权及其后续请款 / 撤销操作；与 `transactionId` 不是同一标识。
                      responseTime:
                        type: string
                        description: 接口响应时间，格式 `yyyy-MM-dd HH:mm:ss`。
                      orderAmount:
                        type: string
                        description: 关联原预授权订单金额；请款仅支持全额请款，本接口无单独请款金额字段。
                      orderCurrency:
                        type: string
                        description: 关联原预授权订单币种，[ISO 4217](https://en.wikipedia.org/wiki/ISO_4217)
                          三位字母货币代码。
                      status:
                        type: string
                        description: 本次请款 / 撤销操作的当前处理状态。
                        enum:
                          - S
                          - F
                          - P
                          - R
                          - N
                          - I
                          - U
                        x-enum-descriptions:
                          S: 交易成功。
                          F: 交易失败。
                          P: 交易处理中。
                          R: 需要跳转以继续支付。
                          N: 交易已取消（含超时未支付关单）。
                          I: 交易审核或审批中。
                          U: 未支付，等待客户完成支付。
                        x-onerway-constraints:
                          - kind: rule
                            text: "`respCode=20000` 仅表示请求处理成功，业务处理结果仍以本字段为准。"
                      paymentStatus:
                        type: string
                        description: 支付意图级状态。
                        enum:
                          - I
                          - U
                          - P
                          - R
                          - A
                          - O
                          - S
                          - N
                        x-enum-descriptions:
                          I: 支付意图已初始化。
                          U: 支付意图待支付。
                          P: 支付意图处理中。
                          R: 支付意图需要跳转。
                          A: 支付意图已授权。
                          O: 支付意图仍打开。
                          S: 支付意图已成功。
                          N: 支付意图已关闭。
                        x-onerway-constraints:
                          - kind: rule
                            text: 与 `data.status`（本次操作状态）是不同状态轴，二者可能不一致；`paymentStatus=A` 表示原预授权仍处于已授权状态。
                      redirectUrl:
                        type:
                          - string
                          - "null"
                        description: 跳转地址；如返回非空，商户应引导用户访问该地址完成后续动作。
                        x-onerway-value:
                          nullable: true
                          empty: true
                          when:
                            en: Has a value only when the customer must continue a verification or redirect
                              flow; usually `null` for capture or void
                              authorization scenarios.
                            zh: 当需要用户继续完成验证或跳转流程时才有值；本接口请款 / 撤销场景通常为 `null`。
                      periodValue:
                        type:
                          - string
                          - "null"
                        description: 分期付款期数。
                        x-onerway-value:
                          nullable: true
                          empty: true
                          when:
                            en: Has a value only for installment transactions; usually `null` for capture or
                              void authorization scenarios.
                            zh: 分期交易才有值；本接口请款 / 撤销场景通常为 `null`。
                      codeForm:
                        type:
                          - string
                          - "null"
                        description: 支付码信息对象（CodeForm），以 JSON 字符串承载。
                        contentMediaType: application/json
                        contentSchema:
                          type: object
                          properties:
                            {}
                        x-onerway-value:
                          nullable: true
                          empty: true
                          when:
                            en: Has a value only when the payment method requires displaying a payment code;
                              usually `null` for capture or void authorization
                              scenarios.
                            zh: 需向用户展示支付码（二维码 / 条码）的支付方式才有值；本接口请款 / 撤销场景通常为 `null`。
                        x-onerway-format: json_string
                      presentContext:
                        type:
                          - string
                          - "null"
                        description: 供渲染支付界面元素的附加上下文，JSON 字符串。
                        x-onerway-value:
                          nullable: true
                          empty: true
                          when:
                            en: Has a value when the transaction needs extra payment UI context; usually
                              `null` for capture or void authorization
                              scenarios.
                            zh: 当交易需要展示额外支付 UI 上下文时才有值；本接口请款 / 撤销场景通常为 `null`。
                      actionType:
                        type:
                          - string
                          - "null"
                        description: 需执行的后续动作类型。
                        enum:
                          - RedirectURL
                          - QrCode
                          - ShowContext
                          - null
                        x-enum-descriptions:
                          RedirectURL: 跳转至支付网关、3DS 页面或本地支付方式页面。
                          QrCode: 展示 `codeForm` 承载的二维码或条码。
                          ShowContext: 展示 `presentContext` 承载的上下文信息。
                        x-onerway-value:
                          nullable: true
                          empty: true
                          when:
                            en: Has a value when the transaction requires an additional action; usually
                              `null` for capture or void authorization
                              scenarios.
                            zh: 当交易需要额外动作时才有值；本接口请款 / 撤销场景通常为 `null`。
                      subscriptionManageUrl:
                        type:
                          - string
                          - "null"
                        description: 订阅管理地址，买家可通过该地址查看和管理订阅。
                        x-onerway-value:
                          nullable: true
                          empty: true
                          when:
                            en: Has a value only in subscription scenarios; usually `null` for capture or
                              void authorization scenarios.
                            zh: 订阅场景才有值；本接口请款 / 撤销场景通常为 `null`。
                      rrn:
                        type:
                          - string
                          - "null"
                        description: 收单参考号（Retrieval Reference Number，RRN），可用于对账与查询。
                        x-onerway-value:
                          nullable: true
                          empty: true
                          when:
                            en: Has a value when the transaction is accepted by the acquiring network and a
                              retrieval reference number is returned; otherwise
                              `null`.
                            zh: 交易被收单网络受理并返回收单参考号时才有值；未返回收单参考号时为 `null`。
                      authorizationCode:
                        type:
                          - string
                          - "null"
                        description: 发卡行授权码，可用于对账与争议处理。
                        x-onerway-value:
                          nullable: true
                          empty: true
                          when:
                            en: Has a value after issuer authorization is approved; failed transactions or
                              responses without an issuer authorization code
                              return `null`.
                            zh: 发卡行授权通过后才有值；失败或未返回授权码时为 `null`。
                      cardInfo:
                        type:
                          - string
                          - "null"
                        description: 卡信息（脱敏），非空时以 JSON 字符串承载；具体内容以实际返回为准。
                        contentMediaType: application/json
                        contentSchema:
                          type: object
                          properties:
                            {}
                        x-onerway-value:
                          nullable: true
                          empty: true
                          when:
                            en: Has a value when masked card information is returned for a card transaction;
                              otherwise `null`.
                            zh: 卡类交易返回脱敏卡信息时才有值；未返回卡信息时为 `null`。
                        x-onerway-format: json_string
                      sign:
                        type: string
                        description: 响应签名字符串；当前不建议商户对响应验签。
                    description: 业务数据对象，承载本次请款 / 撤销操作的处理结果与交易字段。
```
