# Subscriptions API

# Overview {% #overview %}

* **Version:** 2.0
* **Servers**: `https://api.xsolla.com/merchant/v2/`

This API reference describes endpoints for managing subscriptions, coupons, and promotions.
To get more information about Subscriptions, see the [product guide](https://developers.xsolla.com/ja/doc/subscriptions) and the [glossary](https://developers.xsolla.com/ja/doc/subscriptions/integration-guide/get-started/#general_glossary).

Version: 2.0

## Security

### basicAuth

Xsolla API uses basic access authentication. All requests to API must contain the `Authorization: Basic <your_authorization_basic_key>` header, where `<your_authorization_basic_key>` is the `merchant_id:api_key` pair encoded according to the Base64 standard.
Go to **[Xsolla Publisher Account](https://publisher.xsolla.com/) > Company settings** to find <ul><li> `merchant_id` on the Company tab</li><li> `api_key` on the API key tab.</li></ul><br>

Type: http
Scheme: basic

### managementJwtAuth

Type: http
Scheme: bearer

### projectUserJwtAuth

Type: http
Scheme: bearer

## Download OpenAPI description

[Subscriptions API](https://xsolla.redocly.app/_bundle/@l10n/ja/api/subscriptions/index.yaml)

## トークン

### トークンを作成する

 - [POST /merchants/{merchant_id}/token](https://xsolla.redocly.app/ja/api/subscriptions/admin_api_token/create-token.md): 任意のユーザー パラメータを使用してトークンを作成できます。トークンを取得するときにこれらのパラメータを送信し、支払いが成功した後にそれらを受け取ります。トークンには、このドキュメントで説明されているか、またはユーザーが事前に定義したパラメータのみを含めることができます。

パラメータが間違った形式で送信されたり、間違ったタイプである場合、トークンは発行されません。JSON 本文にエラーの説明を含む 422 HTTP コードが返されます。extended_message には、正確にどのパラメータが間違って送信されたかに関する情報が返されます。

  通知APIコールにproject_idパスパラメータが含まれていないため、会社の全プロジェクトで有効なAPIキーを使用して認可を設定する必要があります。

## プラン

### List plans

 - [GET /projects/{project_id}/subscriptions/plans](https://xsolla.redocly.app/ja/api/subscriptions/admin_api_plans/get-plans.md): すべてのサブスクリプションプランを一覧表示します。

### Create plan

 - [POST /projects/{project_id}/subscriptions/plans](https://xsolla.redocly.app/ja/api/subscriptions/admin_api_plans/create-plan.md): サブスクリプションプランを作成します。

### Disable plan

 - [DELETE /projects/{project_id}/subscriptions/plans/{plan_id}](https://xsolla.redocly.app/ja/api/subscriptions/admin_api_plans/disable-plan.md): サブスクリプションプランを無効化します。

### Enable plan

 - [PATCH /projects/{project_id}/subscriptions/plans/{plan_id}](https://xsolla.redocly.app/ja/api/subscriptions/admin_api_plans/enable-plan.md): サブスクリプションプランを有効化します。

### Update plan

 - [PUT /projects/{project_id}/subscriptions/plans/{plan_id}](https://xsolla.redocly.app/ja/api/subscriptions/admin_api_plans/update-plan-parameters.md): サブスクリプションプランパラメータを更新します。

### Delete plan

 - [DELETE /projects/{project_id}/subscriptions/plans/{plan_id}/delete](https://xsolla.redocly.app/ja/api/subscriptions/admin_api_plans/delete-plan.md): サブスクリプションプランを削除します。

## 製品

### List products

 - [GET /projects/{project_id}/subscriptions/products](https://xsolla.redocly.app/ja/api/subscriptions/admin_api_products/get-products.md): すべてのサブスクリプション型の製品を一覧表示します。

### Create product

 - [POST /projects/{project_id}/subscriptions/products](https://xsolla.redocly.app/ja/api/subscriptions/admin_api_products/create-product.md): サブスクリプション型の製品を作成します。

### Delete product

 - [DELETE /projects/{project_id}/subscriptions/products/{product_id}](https://xsolla.redocly.app/ja/api/subscriptions/admin_api_products/delete-product.md): サブスクリプション型の製品を削除します。

### Update product

 - [PUT /projects/{project_id}/subscriptions/products/{product_id}](https://xsolla.redocly.app/ja/api/subscriptions/admin_api_products/update-product.md): サブスクリプション型の製品を更新します。

## サブスクリプション

### Get user account link

 - [POST /api/v1/projects/{projectId}/subscriptions/user_account](https://xsolla.redocly.app/ja/api/subscriptions/admin_api_subscriptions/post-subscriptions-get-user-account-link.md)

### List subscriptions

 - [GET /merchants/{merchant_id}/subscriptions](https://xsolla.redocly.app/ja/api/subscriptions/admin_api_subscriptions/get-subscriptions.md): すべての定期サブスクリプションを一覧表示します。通知この API メソッドは高負荷時には使用できません。最大負荷は 1 分あたり 20 リクエストです。

  通知APIコールにproject_idパスパラメータが含まれていないため、会社の全プロジェクトで有効なAPIキーを使用して認可を設定する必要があります。

### Get subscription

 - [GET /projects/{project_id}/subscriptions/{subscription_id}](https://xsolla.redocly.app/ja/api/subscriptions/admin_api_subscriptions/get-subscription.md): IDで特定のサブスクリプションの詳細を取得。

### Update subscription

 - [PUT /projects/{project_id}/users/{user_id}/subscriptions/{subscription_id}](https://xsolla.redocly.app/ja/api/subscriptions/admin_api_subscriptions/update-subscription.md): ステータスを変更（active、canceled、またはnon_renewing）したり、次の請求日を延期することによって、サブスクリプションを更新します。

## 決済

### List currencies

 - [GET /projects/{project_id}/subscriptions/currencies](https://xsolla.redocly.app/ja/api/subscriptions/admin_api_payments/get-currencies.md): サポートされているすべてのサブスクリプション通貨を一覧表示します。

### List payments

 - [GET /projects/{project_id}/subscriptions/payments](https://xsolla.redocly.app/ja/api/subscriptions/admin_api_payments/get-payments.md): すべてのサブスクリプションの決済を一覧表示します。

### List user payments

 - [GET /projects/{project_id}/users/{user_id}/subscriptions/payments](https://xsolla.redocly.app/ja/api/subscriptions/admin_api_payments/get-user-payments.md): 特定のユーザーが行ったすべての決済を一覧表示します。

## プロモーション

### List promotions

 - [GET /merchants/{merchant_id}/promotions](https://xsolla.redocly.app/ja/api/subscriptions/admin_api_promotions/get-promotions-list.md): すべてのプロモーションのリスト。

  通知APIコールにproject_idパスパラメータが含まれていないため、会社の全プロジェクトで有効なAPIキーを使用して認可を設定する必要があります。

### Create promotion

 - [POST /merchants/{merchant_id}/promotions](https://xsolla.redocly.app/ja/api/subscriptions/admin_api_promotions/create-promotion.md): 新しいプロモーションを作成します。

  通知APIコールにproject_idパスパラメータが含まれていないため、会社の全プロジェクトで有効なAPIキーを使用して認可を設定する必要があります。

### Delete promotion

 - [DELETE /merchants/{merchant_id}/promotions/{promotion_id}](https://xsolla.redocly.app/ja/api/subscriptions/admin_api_promotions/delete-promotion.md): プロモーションを削除します。enabled = false のプロモーションのみ削除できます。

  通知APIコールにproject_idパスパラメータが含まれていないため、会社の全プロジェクトで有効なAPIキーを使用して認可を設定する必要があります。

### Get promotion

 - [GET /merchants/{merchant_id}/promotions/{promotion_id}](https://xsolla.redocly.app/ja/api/subscriptions/admin_api_promotions/get-promotion.md): プロモーションを取得します。

  通知APIコールにproject_idパスパラメータが含まれていないため、会社の全プロジェクトで有効なAPIキーを使用して認可を設定する必要があります。

### Update promotion

 - [PUT /merchants/{merchant_id}/promotions/{promotion_id}](https://xsolla.redocly.app/ja/api/subscriptions/admin_api_promotions/update-promotion.md): プロモーションを更新します。プロモーションが読み取り専用 (read_only = true) の場合、project_id パラメータを変更することはできません。

  通知APIコールにproject_idパスパラメータが含まれていないため、会社の全プロジェクトで有効なAPIキーを使用して認可を設定する必要があります。

### Get payment systems

 - [GET /merchants/{merchant_id}/promotions/{promotion_id}/payment_systems](https://xsolla.redocly.app/ja/api/subscriptions/admin_api_promotions/get-payment-systems.md): プロモーションでサポートされている支払いシステムを取得します。リストが空の場合、プロモーションはすべての支払いシステムに適用されます。

  通知APIコールにproject_idパスパラメータが含まれていないため、会社の全プロジェクトで有効なAPIキーを使用して認可を設定する必要があります。

### Set payment systems

 - [PUT /merchants/{merchant_id}/promotions/{promotion_id}/payment_systems](https://xsolla.redocly.app/ja/api/subscriptions/admin_api_promotions/set-payment-systems.md): プロモーションでサポートされる支払いシステムを設定します。リストが空の場合、プロモーションはすべての支払いシステムに適用されます。プロモーションが読み取り専用 (read_only = true) の場合、このメソッドを呼び出すことはできません。

  通知APIコールにproject_idパスパラメータが含まれていないため、会社の全プロジェクトで有効なAPIキーを使用して認可を設定する必要があります。

### Get validity periods

 - [GET /merchants/{merchant_id}/promotions/{promotion_id}/periods](https://xsolla.redocly.app/ja/api/subscriptions/admin_api_promotions/get-validity-periods.md): プロモーションが有効な日付/時刻の範囲を取得します。

  通知APIコールにproject_idパスパラメータが含まれていないため、会社の全プロジェクトで有効なAPIキーを使用して認可を設定する必要があります。

### Set validity periods

 - [PUT /merchants/{merchant_id}/promotions/{promotion_id}/periods](https://xsolla.redocly.app/ja/api/subscriptions/admin_api_promotions/set-validity-periods.md): プロモーションが有効な日付/時刻の範囲を設定します。プロモーションが読み取り専用 (read_only = true) の場合、既存の期間を編集することはできませんが、新しい期間を追加することはできます。

  通知APIコールにproject_idパスパラメータが含まれていないため、会社の全プロジェクトで有効なAPIキーを使用して認可を設定する必要があります。

### Review promotion

 - [GET /merchants/{merchant_id}/promotions/{promotion_id}/review](https://xsolla.redocly.app/ja/api/subscriptions/admin_api_promotions/review-promotion.md): プロモーションを有効にする前に確認する必要があります。このメソッドは、エラーがある場合はそのリストを返します。

  通知APIコールにproject_idパスパラメータが含まれていないため、会社の全プロジェクトで有効なAPIキーを使用して認可を設定する必要があります。

### Get rewards

 - [GET /merchants/{merchant_id}/promotions/{promotion_id}/rewards](https://xsolla.redocly.app/ja/api/subscriptions/admin_api_promotions/get-rewards.md): プロモーションに関連付けられた報酬のリストを取得します。

  通知APIコールにproject_idパスパラメータが含まれていないため、会社の全プロジェクトで有効なAPIキーを使用して認可を設定する必要があります。

### Set rewards

 - [PUT /merchants/{merchant_id}/promotions/{promotion_id}/rewards](https://xsolla.redocly.app/ja/api/subscriptions/admin_api_promotions/set-rewards.md): プロモーションの報酬を設定します。プロモーションが読み取り専用 (read_only = true) の場合、報酬を更新することはできません。

  通知APIコールにproject_idパスパラメータが含まれていないため、会社の全プロジェクトで有効なAPIキーを使用して認可を設定する必要があります。

### Get promotion scope

 - [GET /merchants/{merchant_id}/promotions/{promotion_id}/subject](https://xsolla.redocly.app/ja/api/subscriptions/admin_api_promotions/get-subject.md): プロモーションの主題に関する情報を取得します。

  通知APIコールにproject_idパスパラメータが含まれていないため、会社の全プロジェクトで有効なAPIキーを使用して認可を設定する必要があります。

### Set promotion scope

 - [PUT /merchants/{merchant_id}/promotions/{promotion_id}/subject](https://xsolla.redocly.app/ja/api/subscriptions/admin_api_promotions/set-subject.md): プロモーションの件名を設定します。プロモーションが読み取り専用 (read_only = true) の場合、件名を更新することはできません。件名には、purchase、items、または packages のいずれかの値を指定できます。

  通知APIコールにproject_idパスパラメータが含まれていないため、会社の全プロジェクトで有効なAPIキーを使用して認可を設定する必要があります。

### Toggle promotion

 - [PUT /merchants/{merchant_id}/promotions/{promotion_id}/toggle](https://xsolla.redocly.app/ja/api/subscriptions/admin_api_promotions/toggle-promotion.md): プロモーションのステータスを enabled から disabled に、またはその逆に切り替えます。

  通知APIコールにproject_idパスパラメータが含まれていないため、会社の全プロジェクトで有効なAPIキーを使用して認可を設定する必要があります。

## クーポン

### Create campaign

 - [POST /merchants/{merchant_id}/coupon_promotions](https://xsolla.redocly.app/ja/api/subscriptions/admin_api_coupons/create-campaign.md): 新しいクーポンキャンペーンを作成します。

通知APIコールにproject_idパスパラメータが含まれていないため、会社の全プロジェクトで有効なAPIキーを使用して認可を設定する必要があります。

### Add coupon to campaign

 - [POST /merchants/{merchant_id}/coupon_promotions/{campaign_id}/coupons](https://xsolla.redocly.app/ja/api/subscriptions/admin_api_coupons/add-coupon-to-campaign.md): クーポン キャンペーンにクーポン コードを追加します。

通知APIコールにproject_idパスパラメータが含まれていないため、会社の全プロジェクトで有効なAPIキーを使用して認可を設定する必要があります。

### Attach campaign to promotion

 - [PUT /merchants/{merchant_id}/promotions/{promotion_id}/coupons](https://xsolla.redocly.app/ja/api/subscriptions/admin_api_coupons/attach-campaign-to-promotion.md): 特定のプロモーションにクーポン キャンペーンを添付します。

  通知APIコールにproject_idパスパラメータが含まれていないため、会社の全プロジェクトで有効なAPIキーを使用して認可を設定する必要があります。

### Get coupon

 - [GET /projects/{project_id}/coupons/{code}/details](https://xsolla.redocly.app/ja/api/subscriptions/admin_api_coupons/get-coupon.md): クーポンの詳細をコードで入手してください。

### Redeem coupon

 - [POST /projects/{project_id}/coupons/{code}/redeem](https://xsolla.redocly.app/ja/api/subscriptions/admin_api_coupons/admin-redeem-coupon.md): クーポンをコードで償還してください。

## サブスクリプション

### List active subscriptions

 - [GET /api/user/v1/projects/{project_id}/subscriptions](https://xsolla.redocly.app/ja/api/subscriptions/client_api_subscriptions/get-user-active-subscriptions.md)

### Buy subscription

 - [POST /api/user/v1/projects/{project_id}/subscriptions/buy](https://xsolla.redocly.app/ja/api/subscriptions/client_api_subscriptions/buy-subscription.md)

### Get management link

 - [POST /api/user/v1/projects/{project_id}/subscriptions/manage](https://xsolla.redocly.app/ja/api/subscriptions/client_api_subscriptions/get-manage-subscriptions-link.md)

### Get user account link

 - [GET /api/user/v1/projects/{project_id}/subscriptions/user_account](https://xsolla.redocly.app/ja/api/subscriptions/client_api_subscriptions/get-user-account-link.md)

### Get subscription

 - [GET /api/user/v1/projects/{project_id}/subscriptions/{subscription_id}](https://xsolla.redocly.app/ja/api/subscriptions/client_api_subscriptions/get-user-subscription.md)

### Cancel subscription

 - [PUT /api/user/v1/projects/{project_id}/subscriptions/{subscription_id}/cancel](https://xsolla.redocly.app/ja/api/subscriptions/client_api_subscriptions/cancel-user-subscription.md)

### Renew subscription

 - [POST /api/user/v1/projects/{project_id}/subscriptions/{subscription_id}/renew](https://xsolla.redocly.app/ja/api/subscriptions/client_api_subscriptions/renew-user-subscription.md)

## Catalog

### List products (no auth)

 - [GET /api/public/v1/projects/{project_id}/products](https://xsolla.redocly.app/ja/api/subscriptions/client_api_catalog/list-public-products.md)

### List plans by product (no auth)

 - [GET /api/public/v1/projects/{project_id}/products/{productId}/user_plans](https://xsolla.redocly.app/ja/api/subscriptions/client_api_catalog/list-public-plans-by-product.md)

### List plans (no auth)

 - [GET /api/public/v1/projects/{project_id}/user_plans](https://xsolla.redocly.app/ja/api/subscriptions/client_api_catalog/list-public-plans.md)

### Get catalog

 - [GET /api/user/v1/projects/{project_id}/catalog](https://xsolla.redocly.app/ja/api/subscriptions/client_api_catalog/get-subscriptions-catalog.md)

### List plans

 - [GET /api/user/v1/projects/{project_id}/plans](https://xsolla.redocly.app/ja/api/subscriptions/client_api_catalog/get-subscription-plans.md)

### List products

 - [GET /api/user/v1/projects/{project_id}/products](https://xsolla.redocly.app/ja/api/subscriptions/client_api_catalog/get-subscription-products.md)

### List plans by product

 - [GET /api/user/v1/projects/{project_id}/products/{productId}/plans](https://xsolla.redocly.app/ja/api/subscriptions/client_api_catalog/get-subscription-plans-by-product.md)

## クーポン

### Redeem coupon

 - [POST /api/user/v1/projects/{project_id}/redeem_coupon](https://xsolla.redocly.app/ja/api/subscriptions/client_api_coupons/redeem-coupon.md)

## サブスクリプション

### List subscriptions

 - [GET /api/user/v1/management/projects/{project_id}/subscriptions](https://xsolla.redocly.app/ja/api/subscriptions/user_management_api_subscriptions/list-subscriptions.md)

### Get management settings

 - [GET /api/user/v1/management/projects/{project_id}/subscriptions/settings](https://xsolla.redocly.app/ja/api/subscriptions/user_management_api_subscriptions/get-management-settings.md)

### Get subscription

 - [GET /api/user/v1/management/projects/{project_id}/subscriptions/{subscription_id}](https://xsolla.redocly.app/ja/api/subscriptions/user_management_api_subscriptions/get-management-subscription.md)

### Activate subscription

 - [PUT /api/user/v1/management/projects/{project_id}/subscriptions/{subscription_id}/activate](https://xsolla.redocly.app/ja/api/subscriptions/user_management_api_subscriptions/activate-subscription.md)

### Cancel subscription

 - [PUT /api/user/v1/management/projects/{project_id}/subscriptions/{subscription_id}/cancel](https://xsolla.redocly.app/ja/api/subscriptions/user_management_api_subscriptions/cancel-subscription.md)

### Get change plan link

 - [POST /api/user/v1/management/projects/{project_id}/subscriptions/{subscription_id}/change_plan](https://xsolla.redocly.app/ja/api/subscriptions/user_management_api_subscriptions/get-change-plan-link.md)

### List plans for change

 - [GET /api/user/v1/management/projects/{project_id}/subscriptions/{subscription_id}/plans_for_change](https://xsolla.redocly.app/ja/api/subscriptions/user_management_api_subscriptions/list-plans-for-change.md)

### Get plan for change

 - [GET /api/user/v1/management/projects/{project_id}/subscriptions/{subscription_id}/plans_for_change/{plan_id}](https://xsolla.redocly.app/ja/api/subscriptions/user_management_api_subscriptions/get-plan-for-change.md)

## Payment accounts

### Get payment account

 - [GET /api/user/v1/management/projects/{project_id}/subscriptions/{subscription_id}/payment_account](https://xsolla.redocly.app/ja/api/subscriptions/user_management_api_payment-accounts/get-payment-account.md)

### Manage payment account

 - [POST /api/user/v1/management/projects/{project_id}/subscriptions/{subscription_id}/payment_account/manage](https://xsolla.redocly.app/ja/api/subscriptions/user_management_api_payment-accounts/manage-payment-account.md)

### List payment accounts

 - [GET /api/user/v1/management/projects/{project_id}/subscriptions/{subscription_id}/payment_accounts](https://xsolla.redocly.app/ja/api/subscriptions/user_management_api_payment-accounts/list-payment-accounts.md)

### Link payment account

 - [POST /api/user/v1/management/projects/{project_id}/subscriptions/{subscription_id}/payment_accounts](https://xsolla.redocly.app/ja/api/subscriptions/user_management_api_payment-accounts/link-payment-account.md)

### Unlink payment account

 - [DELETE /api/user/v1/management/projects/{project_id}/subscriptions/{subscription_id}/payment_accounts/{payment_account_id}](https://xsolla.redocly.app/ja/api/subscriptions/user_management_api_payment-accounts/unlink-payment-account.md)

