> ## 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は、加盟店が顧客のサブスクリプションを永久に停止し、今後の請求サイクルとサービスを防ぐことを可能にします。

### 重要なポイント

<Info>
  ### サブスクリプションをキャンセル

  * このAPIはサブスクリプションをキャンセルし、顧客の今後の請求およびサービスをすべて停止します。一度キャンセルされると、サブスクリプションは再開できません。

  * サブスクリプションをキャンセルすることは、通常、顧客がサービスを終了したり、請求契約を終了したいというリクエストを反映します。

  ### サブスクリプションの状態

  * キャンセル後、サブスクリプションの状態は「キャンセル済み」に変更されます。

  * キャンセルは即時に有効となり、今後の請求サイクルは処理されません。

  ### 必要なパラメータ

  * **サブスクリプションID:** 再開するサブスクリプションの一意の識別子。
</Info>

## フローダイアグラム

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

## APIパラメータ


## OpenAPI

````yaml api-reference/jp/open-api-config/subscription/cancel-subscription.json POST /api/v1/server-to-server-interface/subscription/{subscription_id}/cancel
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/subscription/{subscription_id}/cancel:
    post:
      summary: サブスクリプションをキャンセル
      description: このエンドポイントは、サブスクリプション ID を使用してアクティブなサブスクリプションをキャンセルします。
      operationId: cancelSubscription
      parameters:
        - name: subscription_id
          in: path
          required: true
          schema:
            type: string
            maxLength: 36
            description: サブスクリプションの一意のサブスクリプション ID。
          description: 'サブスクリプションのサブスクリプション ID。例: 664dc930-88bd-4696-8807-5e0f1fedba0b。'
      responses:
        '200':
          description: サブスクリプションがキャンセルされたことを示す成功レスポンス。
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    description: 操作が成功したかどうかを示します。
                    example: true
                  status_code:
                    type: integer
                    description: レスポンスの HTTP ステータスコード。
                    example: 200
                  is_live:
                    type: boolean
                    description: 取引がライブ取引かテスト取引かを示します。
                    example: false
                  gateway_response:
                    type: object
                    description: ゲートウェイからの応答の詳細。
                    properties:
                      version:
                        type: string
                        description: ゲートウェイのバージョン。
                        example: '1'
                      type:
                        type: string
                        description: 応答の種類（例：INFO は情報提供の応答）。
                        example: INFO
                      message:
                        type: string
                        description: ゲートウェイからのメッセージ応答。
                        example: Subscription Updated.
                      code:
                        type: string
                        description: ゲートウェイの応答コード。
                        example: INFO3000
                  subscription_details:
                    type: object
                    description: キャンセルされたサブスクリプションの詳細。
                    properties:
                      id:
                        type: string
                        description: サブスクリプション ID。
                        example: 664dc930-88bd-4696-8807-5e0f1fedba0b
                      type:
                        type: string
                        description: サブスクリプションの種類（例：CYCLE または Unlimited）。
                        example: CYCLE
                      max_cycle_count:
                        type: integer
                        description: 最大請求サイクル数。
                        example: 10
                      status:
                        type: string
                        description: サブスクリプションの更新されたステータス。
                        example: CANCELLED
                      completed_payment_cycle:
                        type: integer
                        description: 完了した請求サイクルの数。
                        example: 1
                      last_payment_status:
                        type: string
                        description: このサブスクリプションの最後の支払いステータス。
                        example: SUCCESSFUL
                      next_payment_date:
                        type: string
                        format: date-time
                        description: サブスクリプションの次回支払日。
                        example: '2024-11-28T01:31:29.154Z'
                      next_payment_cycle:
                        type: integer
                        description: 次の支払いサイクルの番号。
                        example: 2
                      subscription_plan_details:
                        type: object
                        description: サブスクリプションプランの詳細。
                        properties:
                          name:
                            type: string
                            description: サブスクリプションプランの名前。
                            example: Three weeks plan
                          desc:
                            type: string
                            description: サブスクリプションプランの説明。
                            example: Billed every two days
                          billing_cycle_type:
                            type: string
                            description: 請求サイクルの種類（例：日単位または月単位）。
                            example: DAYS
                          billing_cycle_interval:
                            type: integer
                            description: 請求サイクル間隔。
                            example: 2
                          amount:
                            type: integer
                            description: サブスクリプションプランの支払額。
                            example: 1000
                          ccy:
                            type: string
                            description: サブスクリプション取引の通貨。
                            example: JPY
                          trial_period_duration:
                            type: string
                            description: 試用期間の長さ（該当する場合）。
                            example: ''
                          trial_period_duration_type:
                            type: string
                            description: 試用期間の種類（例：日単位または月単位）。
                            example: NONE
                          plan_discount_percentage:
                            type: number
                            description: サブスクリプションプランの割引率。
                            example: 10
                          plan_discount_duration:
                            type: integer
                            description: 割引の適用期間（請求サイクル単位）。
                            example: 2
                      subscription_transaction_details:
                        type: array
                        description: サブスクリプションの取引詳細リスト。
                        items:
                          type: object
                          properties:
                            id:
                              type: string
                              description: このサブスクリプション取引の取引 ID。
                              example: 359f39bd-673a-47b3-b9ec-cbd6cd313b8e
                            ref:
                              type: integer
                              description: サブスクリプション取引の参照番号。
                              example: 74860
                            cycle:
                              type: integer
                              description: 取引の支払いサイクル番号。
                              example: 1
                            status:
                              type: string
                              description: サブスクリプション取引のステータス。
                              example: SUCCESSFUL
                            transaction_date:
                              type: string
                              format: date-time
                              description: サブスクリプション取引の日付。
                              example: '2024-11-26T01:31:29.000Z'
                            amount:
                              type: integer
                              description: 取引の支払額。
                              example: 900
                            ccy:
                              type: string
                              description: 取引の通貨。
                              example: JPY
                            event:
                              type: string
                              description: 取引のイベントタイプ（例：CAPTURED）。
                              example: CAPTURED
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キー。

````