Перейти к содержимому

Введение

  • Версия: 2.0
  • Серверы: https://api.xsolla.com/merchant/v2/

Этот справочник API описывает методы для управления подписками, купонами и акциями. Подробная информация о продукте Subscriptions приведена в руководстве по продукту и глоссарии.

Скачать описание OpenAPI
Языки
Серверы
Mock server
https://xsolla.redocly.app/_mock/ru/api/subscriptions/
Операции
Операции
Операции
Операции
Операции
Операции
Операции
Операции

Запрос

Безопасность
projectUserJwtAuth
Путь
project_idinteger\d+обязательный
Запрос
limitinteger
offsetinteger
localestring
curl -i -X GET \
  'https://xsolla.redocly.app/_mock/ru/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/ru/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>" }
Операции
Операции
Операции
Операции