> ## 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 get /v1/payments/{id}
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}:
    get:
      tags:
        - Payments
      summary: 決済取得
      description: 決済の詳細を取得します
      operationId: getPayment
      parameters:
        - name: id
          in: path
          required: true
          description: トランザクションID
          schema:
            type: string
            example: tx_abc123
      responses:
        '200':
          description: 成功
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaymentDetailResponse'
        '401':
          description: 認証エラー
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: トランザクションが見つからない
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - bearerAuth: []
components:
  schemas:
    PaymentDetailResponse:
      type: object
      properties:
        id:
          type: string
          description: トランザクションID
          example: tx_abc123
        request_id:
          type: string
          description: 決済リクエストID
          example: req_xyz789
        status:
          type: string
          enum:
            - pending
            - requires_action
            - authorized
            - completed
            - failed
            - canceled
            - partially_refunded
            - refunded
          description: ステータス
          example: completed
        amount:
          type: string
          description: 決済金額（文字列形式）
          example: '17.62'
        currency:
          type: string
          description: 通貨コード
          example: usd
        capture_method:
          type: string
          description: キャプチャ方式
          example: automatic
        external_id:
          type: string
          description: 加盟店側の注文ID
          example: order_12345
        payment_method:
          type: string
          description: 決済方法
          example: card
        amount_refunded:
          type: string
          description: 返金済み金額（文字列形式）
          example: '0'
        original_amount:
          type: number
          nullable: true
          description: 通貨変換前の元の金額
          example: null
        original_currency:
          type: string
          nullable: true
          description: 通貨変換前の元の通貨
          example: null
        applied_rate:
          type: number
          nullable: true
          description: 適用された為替レート
          example: null
        card_brand:
          type: string
          nullable: true
          description: カードブランド
          example: visa
        card_last4:
          type: string
          nullable: true
          description: カード番号の下4桁
          example: '4242'
        cardholder_name:
          type: string
          nullable: true
          description: カード名義人
          example: TARO YAMADA
        card_exp_month:
          type: integer
          nullable: true
          description: カード有効期限（月、1〜12）
          example: 12
        card_exp_year:
          type: integer
          nullable: true
          description: カード有効期限（年）
          example: 2028
        card_country:
          type: string
          nullable: true
          description: カード発行国（ISO 3166-1 alpha-2）
          example: JP
        card_funding:
          type: string
          nullable: true
          description: カードの資金源タイプ（credit, debit, prepaid）
          example: credit
        payment_method_id:
          type: string
          nullable: true
          description: 保存されたカードのID（pmi_xxx形式）
          example: null
        is_recurring:
          type: boolean
          description: リカーリング決済の場合true
          example: false
        customer_id:
          type: string
          nullable: true
          description: 顧客ID
          example: null
        email:
          type: string
          nullable: true
          description: 顧客のメールアドレス
          example: customer@example.com
        tel:
          type: string
          nullable: true
          description: 顧客の電話番号
          example: null
        product_name:
          type: string
          nullable: true
          description: 商品名
          example: null
        error_code:
          type: string
          nullable: true
          description: '失敗した決済の統一エラーコード（例: card_declined, insufficient_funds, expired_card）'
          example: null
        refunds:
          type: array
          description: 返金履歴
          items:
            $ref: '#/components/schemas/Refund'
        metadata:
          type: object
          description: メタデータ
          additionalProperties: true
        created_at:
          type: string
          format: date-time
          description: 作成日時
          example: '2024-01-15T10:30:00.000Z'
        updated_at:
          type: string
          format: date-time
          description: 更新日時
          example: '2024-01-15T10:31:00.000Z'
    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
    Refund:
      type: object
      description: 返金履歴（GET /v1/payments/{id}のレスポンスで使用）
      properties:
        id:
          type: string
          description: 返金ID
          example: orf_xyz789
        amount:
          type: string
          description: 返金金額（文字列形式）
          example: '5.50'
        status:
          type: string
          description: 返金ステータス
          example: succeeded
        reason:
          type: string
          description: 返金理由
          example: お客様都合
        created_at:
          type: string
          format: date-time
          description: 返金日時
          example: '2024-01-15T10:35:00Z'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: アクセストークンを使用したBearer認証

````