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

# キャプチャ

> オーソリ済みの決済をキャプチャ（売上確定）します



## OpenAPI

````yaml /api-reference/openapi.ja.json post /v1/payments/{id}/capture
openapi: 3.1.0
info:
  title: ZAFA PAY API
  description: 複数のPSPを統合した決済APIプラットフォーム
  version: 1.0.0
servers:
  - url: https://api.sandbox.zafapay.com
    description: Sandbox環境
  - url: https://api.zafapay.com
    description: 本番環境
security:
  - bearerAuth: []
paths:
  /v1/payments/{id}/capture:
    post:
      tags:
        - Payments
      summary: キャプチャ
      description: オーソリ済みの決済をキャプチャ（売上確定）します
      operationId: capturePayment
      parameters:
        - name: id
          in: path
          required: true
          description: トランザクションID
          schema:
            type: string
            example: tx_abc123
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CaptureRequest'
      responses:
        '200':
          description: キャプチャ成功
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CaptureResponse'
        '400':
          description: キャプチャエラー（既にキャプチャ済み等）
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: 認証エラー
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: トランザクションが見つからない
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - bearerAuth: []
components:
  schemas:
    CaptureRequest:
      type: object
      properties:
        amount:
          type: number
          description: キャプチャ金額（小数点以下2桁まで対応。省略時は全額キャプチャ）
          example: 17.62
    CaptureResponse:
      type: object
      properties:
        id:
          type: string
          description: トランザクションID
          example: tx_abc123
        status:
          type: string
          description: ステータス
          example: completed
        amount:
          type: number
          description: キャプチャ金額
          example: 17.62
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            type:
              type: string
              description: エラーの種類
              enum:
                - authentication_error
                - authorization_error
                - invalid_request_error
                - payment_error
                - rate_limit_error
                - api_error
              example: invalid_request_error
            code:
              type: string
              description: エラーコード
              example: validation_error
            message:
              type: string
              description: エラーメッセージ
              example: Invalid request parameters
            param:
              type: string
              description: エラーの原因となったパラメータ名
              example: amount
            details:
              type: array
              description: バリデーションエラーの詳細
              items:
                type: object
                properties:
                  path:
                    type: array
                    items:
                      type: string
                  message:
                    type: string
            request_id:
              type: string
              description: リクエストID
              example: req_abc123xyz789
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: アクセストークンを使用したBearer認証

````