コンテンツへスキップ

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/
操作
操作
操作

Subscription management

操作

リクエスト

IDで特定のサブスクリプションの詳細を取得。

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

プロジェクトID。

subscription_idinteger必須

サブスクリプションID。

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

レスポンス

OK。

ボディapplication/json
charge_amountnumber(float)

請求額。

commentstring

サブスクリプション状態を変更する理由

currencystring

購入通貨。ISO 4217に基づく3文字の通貨コード。

date_createstring(datetime)

ISO 8601に基づくYYYY-MM-DD’T’HH:MM:SSフォーマットのサブスクリプション作成日。

date_endstring(datetime)

ISO 8601に基づくYYYY-MM-DD’T’HH:MM:SSフォーマットのサブスクリプション終了日。

date_last_chargestring or null(datetime)

ISO 8601に基づくYYYY-MM-DD’T’HH:MM:SSフォーマットのサブスクリプション最終請求日。

date_next_chargestring or null(datetime)

ISO 8601に基づくYYYY-MM-DD’T’HH:MM:SSフォーマットの次回のサブスクリプション請求日。

idinteger

サブスクリプションID

planobject
productobject or null
statusstring

状態

列挙型"new""active""canceled""non_renewing""freeze"
userobject
レスポンス
application/json
{ "charge_amount": 0.03, "comment": "The subscription was not extended in due time", "currency": "USD", "date_create": "2018-09-21T16:54:59+03:00", "date_end": "2019-02-06T12:43:04+03:00", "date_last_charge": "2018-09-21T16:55:05+03:00", "date_next_charge": "2018-09-21T16:55:05+03:00", "id": 249579, "plan": { "external_id": "lowcost", "id": 601 }, "product": { "id": 123456 }, "status": "canceled", "user": { "id": "user1", "name": "John Smith" } }

サブスクリプションの更新

リクエスト

ステータスを変更(activecanceled、またはnon_renewing)したり、次の請求日を延期することによって、サブスクリプションを更新します。

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

プロジェクトID。

user_idstring必須

ユーザーID。

subscription_idinteger必須

サブスクリプションID。

ボディapplication/json必須
cancel_subscription_paymentboolean

trueに設定すると、このサブスクリプションで最後に支払った決済分が払い戻されます。canceledに設定したステータスと共にのみ実行できます

statusstring

ステータス。

列挙型"active""canceled""non_renewing"
timeshiftobject

請求の延期。

xsolla_networkobject
curl -i -X PUT \
  -u <username>:<password> \
  'https://xsolla.redocly.app/_mock/ja/api/subscriptions/projects/{project_id}/users/{user_id}/subscriptions/{subscription_id}' \
  -H 'Content-Type: application/json' \
  -d '{
    "status": "active"
  }'

レスポンス

OK。

ボディapplication/json
レスポンス
application/json
{ "charge_amount": 0.03, "currency": "USD", "date_create": "2018-09-21T16:54:59+03:00", "date_end": null, "date_last_charge": "2018-09-21T16:55:05+03:00", "date_next_charge": "2018-09-21T16:55:05+03:00", "id": 24953579, "plan": { "billing_retry": {}, "charge": {}, "description": null, "expiration": {}, "external_id": "lowcost", "grace_period": {}, "group_id": "newPlans", "id": 66001, "localized_name": null, "name": null, "project_id": 18404, "refund_period": null, "status": {}, "tags": null, "trial": {}, "type": "all" }, "product": null, "status": "active", "user": { "id": "jb1", "name": "J.Black" } }
操作

プロモーション

操作
操作

Subscription management

操作