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

# 返金API

> 返金APIは、成功した購入またはキャプチャ取引後に顧客に資金を返金するために使用されます。

<Warning>注意：以下の決済方法では返金はサポートされていません：PayPay、Pay-Easy、Konbini。</Warning>

### 重要なポイント

<Info>
  * 返金APIは、加盟店が取引を取り消し、資金を顧客の支払い方法に返金することを可能にします。

  * このAPIは、注文キャンセル、商品返品、または顧客が請求に異議を唱える場合などのシナリオで一般的に使用されます。

  * 返金は、返金リクエストに指定された金額に応じて部分的または全額で行うことができます。部分的に返金された場合でも、元の取引の残高は有効です。
</Info>

## フローダイアグラム

<img src="https://mintcdn.com/dasdoc/kfo25CLU3J6KbVVp/images/timeline-diagram/flows-API-refund-jp.svg?fit=max&auto=format&n=kfo25CLU3J6KbVVp&q=85&s=5ee3fcf76fe97febe64c03fe302e2262" alt="フローダイアグラム" width="1997" height="868" data-path="images/timeline-diagram/flows-API-refund-jp.svg" />

## APIパラメータ


## OpenAPI

````yaml api-reference/jp/open-api-config/server-to-server/refund.json POST /api/v1/server-to-server-interface/refund
openapi: 3.0.1
info:
  title: Payment Options API
  description: ホストされた支払いページ（HPP）リンクを生成し、支払いを処理するためのAPI。
  version: 1.0.0
servers:
  - url: https://api-dev.paymentoptions.com
security:
  - apiKeyAuth: []
    xApiKeyAuth: []
paths:
  /api/v1/server-to-server-interface/refund:
    post:
      summary: 取引を払い戻す
      description: このエンドポイントは、加盟店がキャプチャまたは購入した取引金額を払い戻すことを可能にします。
      operationId: refundTransaction
      requestBody:
        description: 取引を払い戻すためのリクエストペイロード。
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              properties:
                transactionId:
                  type: string
                  description: 承認された取引の元の取引ID。
                  example: 9dfd39ec-eb4a-4f8b-a526-17abf140a717
                  maxLength: 36
                amount:
                  type: integer
                  description: 払い戻される金額。これはキャプチャまたは購入した金額を超えてはいけません。金額の制限は銀行によって異なります。
                  example: 1000
                merchant_id:
                  type: string
                  description: 加盟店ID（DASMID）。
                  example: < Merchant ID >
                  maxLength: 10
                notes:
                  type: string
                  description: 払い戻し取引の参照（オプション）。
                  example: Refund amount captured/purchased
                  maxLength: 128
              required:
                - transactionId
                - amount
                - merchant_id
      responses:
        '201':
          description: 取引が正常に払い戻されました。
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    description: 取引が成功した場合はtrue、失敗した場合はfalse。
                    example: true
                  status_code:
                    type: integer
                    description: 取引のステータスコード。
                    example: 201
                  is_live:
                    type: boolean
                    description: 本番取引の場合はtrue、テスト取引の場合はfalse。
                    example: false
                  transaction_type:
                    type: string
                    description: 取引タイプ（例：REFUND）。
                    example: REFUND
                  gateway_response:
                    type: object
                    description: ゲートウェイからの応答を含むJSONオブジェクト。
                    properties:
                      version:
                        type: string
                        description: ゲートウェイのバージョン。
                        example: '1'
                      type:
                        type: string
                        description: 応答のタイプ（例：INFO）。
                        example: INFO
                      message:
                        type: string
                        description: ゲートウェイからのメッセージ応答。
                        example: 金額が正常に払い戻されました。
                      code:
                        type: string
                        description: 応答のメッセージコード。
                        example: INFO0002
                  merchant_details:
                    type: object
                    description: 加盟店の詳細を含むJSONオブジェクト。
                    properties:
                      legal_name:
                        type: string
                        description: 加盟店の正式名称。
                        example: Tink15 Factory
                      mid:
                        type: string
                        description: 加盟店ID（DASMID）。
                        example: < Merchant ID >
                      merchant_txn_ref:
                        type: string
                        description: 加盟店の取引参照。
                        example: qwe
                  payment_details:
                    type: object
                    description: 取引の支払い詳細を含むJSONオブジェクト。
                    properties:
                      amount:
                        type: number
                        description: 取引の金額。
                        example: 1000
                      response_code:
                        type: integer
                        description: アクワイアラー応答コード。
                        example: 0
                      auth_code:
                        type: string
                        description: アクワイアラーの認証コード。
                        example: '264302'
                      currency:
                        type: string
                        description: 取引の通貨。
                        example: JPY
                      payment_method:
                        type: string
                        description: 支払いカードの種類（例：クレジットカードまたはデビットカード）。
                        example: ECMC-SSL
                      scheme:
                        type: string
                        description: カードブランドのスキーム（例：MASTERCARD）。
                        example: MASTERCARD
                      card:
                        type: object
                        description: カードの詳細を含むJSONオブジェクト。
                        properties:
                          name:
                            type: string
                            description: カード所有者の名前。
                            example: John Doe
                          number:
                            type: string
                            description: カード番号（マスク済み）。
                            example: '5200000000001005'
                          exp_month:
                            type: string
                            description: カードの有効期限の月。
                            example: '12'
                          exp_year:
                            type: string
                            description: カードの有効期限の年。
                            example: '29'
                      additional_data:
                        type: object
                        description: 追加データを含むJSONオブジェクト。
                        properties:
                          payment_data_source:
                            type: object
                            description: 支払いデータソースを含むJSONオブジェクト。
                            properties:
                              type:
                                type: string
                                description: 支払いデータソースの種類（例：カード、GooglePay、ApplePay）。
                                example: card
                  transaction_details:
                    type: object
                    description: 取引の詳細を含むJSONオブジェクト。
                    properties:
                      id:
                        type: string
                        description: 取引のトランザクションID。
                        example: 626fa81d-9819-4947-bb9b-b0f11e00a50e
                      ref:
                        type: integer
                        description: 取引の認証コード。
                        example: 74824
                      timestamp:
                        type: string
                        description: 取引の日付と時刻。
                        example: '2024-11-25T08:51:52.000Z'
                      merchant_txn_ref:
                        type: string
                        description: 加盟店の取引参照ID。
                        example: qwe
components:
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      name: Authorization
      in: header
      description: 認証のためのAPIキー。形式：'Basic YOUR_API_KEY_HERE'
    xApiKeyAuth:
      type: apiKey
      name: x-api-key
      in: header
      description: x-api-key専用のAPIキー。

````