# Capture or void authorization

> Capture a successful pre-authorization or void it to release the reserved amount.

```yaml
openapi: 3.1.0
info:
  title: Capture or void authorization
  version: 1.0.0
  description: Capture a successful pre-authorization or void it to release the
    reserved amount.
paths:
  /v1/txn/authPayment:
    post:
      summary: Capture or void authorization
      description: Capture a successful pre-authorization or void it to release the
        reserved amount.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                merchantNo:
                  type: string
                  description: Merchant number assigned by Onerway. See
                    [Setup](/payments/get-started/setup#retrieve-your-credentials)
                    for how to obtain it.
                txnType:
                  type: string
                  description: Authorization follow-up operation to execute. Use `CAPTURE` to
                    capture the authorized amount or `VOID` to release the
                    authorization.
                  enum:
                    - CAPTURE
                    - VOID
                  x-enum-descriptions:
                    CAPTURE: Capture a previously successful pre-authorization. This endpoint
                      supports full capture only.
                    VOID: Void a previously successful pre-authorization, release the reserved
                      amount, and do not debit the cardholder.
                merchantTxnId:
                  type: string
                  description: Merchant transaction order number for this capture or void
                    operation. Different order numbers are treated as different
                    transactions.
                originTransactionId:
                  type: string
                  description: Original pre-authorization transaction number returned by Onerway.
                    It identifies the authorization that should be captured or
                    voided.
                sign:
                  type: string
                  description: Request signature string. See [Request
                    signing](/payments/get-started/request-signing) for how to
                    generate it.
              required:
                - merchantNo
                - txnType
                - originTransactionId
                - sign
            examples:
              capture-authorization:
                summary: Capture authorization
                value:
                  merchantNo: replace_with_merchant_no
                  merchantTxnId: txn_demo_capture_202606210001
                  originTransactionId: example_original_auth_transaction_id
                  sign: "{{SIGN}}"
                  txnType: CAPTURE
              void-authorization:
                summary: Void authorization
                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: Response code; `20000` means the request was processed
                      successfully, other values are error codes. See [Response
                      codes](/payments/api-reference/response-codes).
                  respMsg:
                    type: string
                    description: Human-readable message for the response code.
                  data:
                    type: object
                    properties:
                      transactionId:
                        type: string
                        description: Transaction number generated by Onerway for this capture or void
                          operation. Use it to track and query this operation;
                          do not confuse it with the original pre-authorization
                          transaction number passed as `originTransactionId`.
                      paymentId:
                        type: string
                        description: Payment intent ID used to associate the original pre-authorization
                          and its later capture or void operation. It is not the
                          same identifier as `transactionId`.
                      responseTime:
                        type: string
                        description: API response time in `yyyy-MM-dd HH:mm:ss` format.
                      orderAmount:
                        type: string
                        description: Order amount of the related original pre-authorization. Capture
                          supports the full authorized amount only; this
                          endpoint does not provide a separate capture amount
                          field.
                      orderCurrency:
                        type: string
                        description: Order currency of the related original pre-authorization, as a
                          three-letter [ISO
                          4217](https://en.wikipedia.org/wiki/ISO_4217) currency
                          code.
                      status:
                        type: string
                        description: Current processing status of this capture or void operation.
                        enum:
                          - S
                          - F
                          - P
                          - R
                          - N
                          - I
                          - U
                        x-enum-descriptions:
                          S: Successful transaction.
                          F: Failed transaction.
                          P: Transaction is processing.
                          R: Redirect is required to continue payment.
                          N: Transaction was canceled, including closure after timing out without payment.
                          I: Transaction is under review or approval.
                          U: Waiting for payment.
                        x-onerway-constraints:
                          - kind: rule
                            text: "`respCode=20000` only means the request was processed successfully. Use
                              this field as the business processing result for
                              the capture or void operation."
                      paymentStatus:
                        type: string
                        description: Payment-intent-level status.
                        enum:
                          - I
                          - U
                          - P
                          - R
                          - A
                          - O
                          - S
                          - N
                        x-enum-descriptions:
                          I: Initialized payment intent.
                          U: Payment intent is pending.
                          P: Payment intent is processing.
                          R: Payment intent requires redirect.
                          A: Payment intent is authorized.
                          O: Payment intent is open.
                          S: Payment intent succeeded.
                          N: Payment intent is closed.
                        x-onerway-constraints:
                          - kind: rule
                            text: This is a payment-intent-level status, separate from `data.status`. The
                              two status axes may differ; for example,
                              `paymentStatus=A` means the original
                              pre-authorization is still authorized.
                      redirectUrl:
                        type:
                          - string
                          - "null"
                        description: Redirect URL. If a non-empty value is returned, guide the customer
                          to this URL to complete the next action.
                        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: Number of installment periods.
                        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: Payment code information object, carried as a JSON string.
                        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: Additional context for rendering payment interface elements,
                          carried as a JSON string.
                        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: Next action type to execute.
                        enum:
                          - RedirectURL
                          - QrCode
                          - ShowContext
                          - null
                        x-enum-descriptions:
                          RedirectURL: Redirect to a payment gateway, 3DS page, or local payment method
                            page.
                          QrCode: Display a QR code or barcode carried by `codeForm`.
                          ShowContext: Display contextual content carried by `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: Subscription management URL where the buyer can view and manage the
                          subscription.
                        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), used for reconciliation and
                          inquiries.
                        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: Issuer authorization code, used for reconciliation and dispute
                          handling.
                        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: Masked card information, carried as a JSON string when present. The
                          exact content follows the actual response.
                        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: Response signature string. Onerway currently does not recommend
                          response signature verification by merchants.
                    description: Business data object carrying the processing result and transaction
                      fields for this capture or void operation.
```
