跳转到内容

概览

  • Version: 2.0
  • 服务器https://api.xsolla.com/merchant/v2/

本API参考介绍管理订阅、优惠券和促销活动的端点。 如需了解关于订阅的详细信息,请参考产品指南词汇表

下载 OpenAPI 描述
语言
服务器
Mock server
https://xsolla.redocly.app/_mock/zh/api/subscriptions/
操作
操作
操作
操作
操作
操作
操作
操作

请求

安全
projectUserJwtAuth
路径
project_idinteger\d+必需
查询
limitinteger
offsetinteger
localestring
curl -i -X GET \
  'https://xsolla.redocly.app/_mock/zh/api/subscriptions/api/user/v1/projects/{project_id}/subscriptions?limit=0&offset=0&locale=string' \
  -H 'Authorization: Bearer <YOUR_TOKEN_HERE>'

响应

Get subscription info

正文application/json
has_moreboolean必需
示例: "false"
itemsArray of objects
默认值 []
items[].​chargeobject必需
items[].​charge.​amountnumber(float)必需
示例: 4.99
items[].​charge.​amount_with_promotionnumber or null(float)
默认值 null
示例: 3.99
items[].​charge.​currencystring必需
示例: "USD"
items[].​date_createstring(date-time)必需
示例: "2031-04-11T13:51:02+03:00"
items[].​date_last_chargestring or null(date-time)
示例: "2031-04-11T13:51:02+03:00"
items[].​date_next_chargestring or null(date-time)
示例: "2031-04-11T13:51:02+03:00"
items[].​idinteger必需
示例: "12345"
items[].​is_in_trialboolean必需
示例: "false"
items[].​periodobject必需
items[].​period.​unitstring or null
默认值 null
示例: "month"
items[].​period.​valueinteger or null
默认值 null
示例: "1"
items[].​plan_descriptionstring必需
示例: "Localized plan description"
items[].​plan_end_datestring or null(date-time)
示例: "2031-04-11T13:51:02+03:00"
items[].​plan_external_idstring必需
示例: "PlanExternalId"
items[].​plan_idinteger必需
示例: "54321"
items[].​plan_namestring必需
示例: "Localized plan name"
items[].​plan_start_datestring or null(date-time)
示例: "2021-04-11T13:51:02+03:00"
items[].​product_descriptionstring or null
示例: "Localized product description"
items[].​product_external_idstring or null
示例: "ProductExternalId"
items[].​product_idinteger or null
示例: "12345"
items[].​product_namestring or null
示例: "Product name"
items[].​statusstring必需
示例: "active"
items[].​trial_periodinteger or null
示例: "0"
响应
application/json
{ "has_more": "false", "items": [] }

请求

安全
projectUserJwtAuth
路径
project_idinteger\d+必需
查询
countrystring
正文application/json必需

Buy subscription

available_plansobject or null

包含订阅套餐相关数据的数组。只有这些套餐会显示在支付用户界面中。

默认值 null
custom_parametersobject or null

You can pass additional parameters in the token

默认值 null
plan_external_idstring or null

You must provide either a plan_external_id

默认值 null
示例: "PlanExternalId"
product_idinteger or null

ID of the product associated with the plan

默认值 null
示例: "12345"
settings(object or null)
(object or null)
curl -i -X POST \
  'https://xsolla.redocly.app/_mock/zh/api/subscriptions/api/user/v1/projects/{project_id}/subscriptions/buy?country=string' \
  -H 'Authorization: Bearer <YOUR_TOKEN_HERE>' \
  -H 'Content-Type: application/json' \
  -d '{
    "available_plans": null,
    "custom_parameters": null,
    "plan_external_id": "PlanExternalId",
    "product_id": "12345",
    "settings": {
      "currency": "str",
      "external_id": "string",
      "hide_saved_payment_accounts": true,
      "locale": "st",
      "payment_method": 1,
      "redirect_policy": {
        "delay": 0,
        "redirect_button_caption": "string",
        "redirect_conditions": "none",
        "status_for_manual_redirection": "none"
      },
      "return_url": "string",
      "steam_user_id": "stringstringstrin",
      "ui": {
        "desktop": {
          "header": {
            "close_button": true,
            "is_visible": true,
            "type": "compact",
            "visible_logo": true,
            "visible_name": true
          }
        },
        "independent_windows": true,
        "license_url": "string",
        "mobile": {
          "footer": {
            "is_visible": true
          },
          "header": {
            "close_button": true
          },
          "mode": "saved_accounts"
        },
        "mode": "user_account",
        "size": "large",
        "theme": "string",
        "user_account": {
          "history": {
            "enable": true,
            "order": 1
          },
          "info": {
            "enable": true,
            "order": 1
          },
          "payment_accounts": {
            "enable": true,
            "order": 1
          },
          "subscriptions": {
            "enable": true,
            "order": 1
          }
        },
        "version": "desktop"
      },
      "xsolla_product_tag": "string"
    }
  }'

响应

Get buy subscription url

正文application/json
link_to_psstring必需
示例: "https://secure.xsolla.com/paystation2/?access_token=<access_token>"
响应
application/json
{ "link_to_ps": "https://secure.xsolla.com/paystation2/?access_token=<access_token>" }
操作
操作
操作
操作