コンテンツへスキップ

Subscriptions API (2.0)

概要

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

このAPIリファレンスでは、サブスクリプション、クーポン、およびプロモーションを管理するためのエンドポイントについて説明します。 サブスクリプションの詳細については、製品ガイドおよび用語集を参照してください。

OpenAPI記述をダウンロード
言語
サーバー
Mock server
https://xsolla.redocly.app/_mock/ja/api/subscriptions/
操作
操作

プランの作成

リクエスト

サブスクリプションプランを作成します。

セキュリティ
basicAuth
パス
project_idinteger必須

プロジェクトID。

ボディapplication/json必須
billing_retryobject

請求再試行の詳細。

chargeobject必須

請求の詳細。

charge.​amountnumber(float)

請求額。

charge.​currencystring

購入通貨。ISO 4217に準拠した3文字の通貨コード。

charge.​periodobject必須

請求期間。

charge.​period.​typestring必須

時間の単位。daymonthまたはlifetimeにすることができます。

列挙型"day""month""lifetime"
charge.​period.​valueinteger必須

時間単位の数。値はタイプパラメータに依存し、次のようになります:
-typedayの場合 、1から366まで
-typemonthの場合、1から12まで、
-typelifetimeの場合、0です

charge.​pricesArray of objects

異なる通貨での価格を一覧表示します。

descriptionobject

プランの説明文。"localization":"plan description"のペアで構成されます。

expirationobject

サブスクリプションの有効期限の詳細。

external_idstring

プラン外部ID(32文字)。

grace_periodobject

猶予期間の詳細。

group_idstring or null

プランがリンクされているグループID。

idinteger

サブスクリプションプラン ID。

nameobject必須

プラン名。"localization":"plan name"のペアで構成されます。

name.​arstring

アラビア語。

name.​bgstring

ブルガリア語。

name.​cnstring

中国語(簡体字)。

name.​csstring

チェコ語。

name.​destring

ドイツ語。

name.​enstring

英語。

name.​esstring

スペイン語。

name.​frstring

フランス語。

name.​hestring

ヘブライ語。

name.​itstring

イタリア語。

name.​jastring

日本語。

name.​kostring

韓国語。

name.​plstring

ポーランド語。

name.​ptstring

ポルトガル語。

name.​rostring

ルーマニア語。

name.​rustring

ロシア語。

name.​thstring

タイ語。

name.​trstring

トルコ語。

name.​twstring

中国語(繁体字)。

name.​vistring

ベトナム語。

project_idinteger

プロジェクトID。

refund_periodinteger or null

ユーザーがサブスクリプションプランの支払いを返金できる期間(日単位)。

statusobject
tagsArray of strings

プランのタグ。

trialobject

試用期間の詳細。

curl -i -X POST \
  -u <username>:<password> \
  'https://xsolla.redocly.app/_mock/ja/api/subscriptions/projects/{project_id}/subscriptions/plans' \
  -H 'Content-Type: application/json' \
  -d '{
    "billing_retry": {
      "value": 1
    },
    "charge": {
      "amount": 10,
      "currency": "USD",
      "period": {
        "type": "month",
        "value": 1
      },
      "prices": [
        {
          "amount": 8,
          "currency": "EUR",
          "setup_fee": 1.5
        },
        {
          "amount": 1000,
          "currency": "JPY",
          "setup_fee": 2.5
        }
      ]
    },
    "description": {
      "en": "2x more experience!"
    },
    "expiration": {
      "type": "day",
      "value": null
    },
    "external_id": "exp",
    "grace_period": {
      "type": "day",
      "value": 2
    },
    "name": {
      "en": "Experience boost"
    },
    "refund_period": null,
    "status": {
      "value": "active"
    },
    "trial": {
      "type": "day",
      "value": 7
    }
  }'

レスポンス

作成されました。

ボディapplication/json
external_idstring
plan_idinteger
レスポンス
application/json
{ "external_id": "exp", "plan_id": 241082 }

プランの無効化

リクエスト

サブスクリプションプランを無効化します。

セキュリティ
basicAuth
パス
project_idinteger必須

プロジェクトID。

plan_idinteger必須

プランID。

curl -i -X DELETE \
  -u <username>:<password> \
  'https://xsolla.redocly.app/_mock/ja/api/subscriptions/projects/{project_id}/subscriptions/plans/{plan_id}'

レスポンス

No Content (コンテンツなし) 。

プランの有効化

リクエスト

サブスクリプションプランを有効化します。

セキュリティ
basicAuth
パス
project_idinteger必須

プロジェクトID。

plan_idinteger必須

プランID。

curl -i -X PATCH \
  -u <username>:<password> \
  'https://xsolla.redocly.app/_mock/ja/api/subscriptions/projects/{project_id}/subscriptions/plans/{plan_id}'

レスポンス

No Content (コンテンツなし) 。

操作

Subscription management

操作
操作

プロモーション

操作
操作

Subscription management

操作