Skip to content

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 and the glossary.

Download OpenAPI description
Languages
Servers
Mock server
https://xsolla.redocly.app/_mock/api/subscriptions/
Operations
Operations
Operations
Operations

Request

Gets a specific subscription details by ID.

Security
basicAuth
Path
project_idintegerrequired

Project ID.

subscription_idintegerrequired

Subscription ID.

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

Responses

OK.

Bodyapplication/json
idinteger

Subscription ID

planobject
plan.​project_idinteger

Project ID.

plan.​nameobject

Plan name. Value consists of pairs "localization":"plan name".

plan.​name.​enstring

English.

plan.​name.​rustring

Russian.

plan.​name.​csstring

Czech.

plan.​name.​arstring

Arabic.

plan.​name.​bgstring

Bulgarian.

plan.​name.​cnstring

Chinese (Simplified).

plan.​name.​twstring

Chinese (Traditional).

plan.​name.​frstring

French.

plan.​name.​destring

German.

plan.​name.​hestring

Hebrew.

plan.​name.​itstring

Italian.

plan.​name.​kostring

Korean.

plan.​name.​plstring

Polish.

plan.​name.​ptstring

Portuguese.

plan.​name.​rostring

Romanian.

plan.​name.​esstring

Spanish.

plan.​name.​thstring

Thai.

plan.​name.​trstring

Turkish.

plan.​name.​vistring

Vietnamese.

plan.​name.​jastring

Japanese.

plan.​chargeobject

Billing details.

plan.​charge.​periodobjectrequired

Billing period.

plan.​charge.​period.​valueintegerrequired

Number of time units. The value depends on the type parameter and can be:
- from 1 to 366, if type is day
- from 1 to 12, if type is month
- 0 if type is lifetime

plan.​charge.​period.​typestringrequired

Time unit. Can be day, month or lifetime.

Enum"day""month""lifetime"
plan.​charge.​amountnumber(float)

Billing amount.

plan.​charge.​currencystring

Currency of the purchase. Three-letter currency code per ISO 4217.

plan.​charge.​pricesArray of objects

List of prices in different currencies.

plan.​charge.​prices[].​amountnumber(float)required

Billing amount.

plan.​charge.​prices[].​currencystringrequired

Currency of the purchase. Three-letter currency code per ISO 4217.

plan.​charge.​prices[].​setup_feenumber(float)

One-time setup fee charged as part of the first invoice.

plan.​idinteger

Subscription plan ID.

plan.​external_idstring

Plan external ID (32 characters).

plan.​descriptionobject

Plan description. Value consists of pairs "localization":"plan description".

plan.​description.​enstring

English.

plan.​description.​rustring

Russian.

plan.​description.​csstring

Czech.

plan.​description.​arstring

Arabic.

plan.​description.​bgstring

Bulgarian.

plan.​description.​cnstring

Chinese (Simplified).

plan.​description.​twstring

Chinese (Traditional).

plan.​description.​frstring

French.

plan.​description.​destring

German.

plan.​description.​hestring

Hebrew.

plan.​description.​itstring

Italian.

plan.​description.​kostring

Korean.

plan.​description.​plstring

Polish.

plan.​description.​ptstring

Portuguese.

plan.​description.​rostring

Romanian.

plan.​description.​esstring

Spanish.

plan.​description.​thstring

Thai.

plan.​description.​trstring

Turkish.

plan.​description.​vistring

Vietnamese.

plan.​description.​jastring

Japanese.

plan.​group_idstring or null

Group ID the plan is linked to.

plan.​expirationobject

Subscription expiration details.

plan.​expiration.​valueinteger or nullrequired

Validity time.

plan.​expiration.​typestringrequired

Time unit. Can be day or month.

Enum"day""month"
plan.​trialobject

Trial period details.

plan.​trial.​valueintegerrequired

Number of time units.

plan.​trial.​typestringrequired

Time unit. Can be day.

Value"day"
plan.​grace_periodobject

Grace period details.

plan.​grace_period.​valueintegerrequired

Number of time units.

plan.​grace_period.​typestringrequired

Time unit. Can be day.

Value"day"
plan.​billing_retryobject

Billing retry details.

plan.​billing_retry.​valueintegerrequired

Number of billing retries.

plan.​refund_periodinteger or null

Period of time that user can refund the payment for a subscription plan (in days).

plan.​tagsArray of strings

Plan tags.

plan.​statusobject
plan.​status.​valuestring

Subscription plan status.

Enum"active""disabled"
userobject
user.​idstring

User ID

user.​namestring

User name

productobject or null
product.​idinteger or null

Product ID the plans are linked to.

product.​namestring

Product name.

product.​group_idstring

Group ID the product is linked to.

product.​descriptionobject

Localized item descriptions.

product.​description.​enstring

English.

product.​description.​rustring

Russian.

product.​description.​csstring

Czech.

product.​description.​arstring

Arabic.

product.​description.​bgstring

Bulgarian.

product.​description.​cnstring

Chinese (Simplified).

product.​description.​twstring

Chinese (Traditional).

product.​description.​frstring

French.

product.​description.​destring

German.

product.​description.​hestring

Hebrew.

product.​description.​itstring

Italian.

product.​description.​kostring

Korean.

product.​description.​plstring

Polish.

product.​description.​ptstring

Portuguese.

product.​description.​rostring

Romanian.

product.​description.​esstring

Spanish.

product.​description.​thstring

Thai.

product.​description.​trstring

Turkish.

product.​description.​vistring

Vietnamese.

product.​description.​jastring

Japanese.

charge_amountnumber(float)

Billing amount.

currencystring

Currency of the purchase. Three-letter currency code per ISO 4217.

date_createstring(datetime)

Subscription creation date in the YYYY-MM-DD’T’HH:MM:SS format per ISO 8601.

date_endstring(datetime)

Subscription end date in the YYYY-MM-DD’T’HH:MM:SS format per ISO 8601.

date_last_chargestring or null(datetime)

Last subscription charge date in the YYYY-MM-DD’T’HH:MM:SS format per ISO 8601.

date_next_chargestring or null(datetime)

Next subscription charge date in the YYYY-MM-DD’T’HH:MM:SS format per ISO 8601.

statusstring

Status

Enum"new""active""canceled""non_renewing""freeze"
commentstring

Reason for changing subscription status

Response
application/json
{ "charge_amount": 0.03, "comment": "The subscription was not extended in due time\r", "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" } }

Request

Updates a subscription by either changing its status (active, canceled, or non_renewing) or postponing the next billing date.

Security
basicAuth
Path
project_idintegerrequired

Project ID.

user_idstringrequired

User ID.

subscription_idintegerrequired

Subscription ID.

Bodyapplication/jsonrequired
statusstring

Status.

Enum"active""canceled""non_renewing"
cancel_subscription_paymentboolean

Setting to true will refund the last payment made for this subscription. Only works together with setting the status to canceled.

timeshiftobject

Billing postponement.

timeshift.​typestring

Billing time unit. Can be day or month.

Enum"day""month"
timeshift.​valuestring

Number of time units to postpone the billing by. The value depends on the type parameter and can be:
- from 1 to 366, if type is day
- from 1 to 12, if type is month

xsolla_networkobject
xsolla_network.​collaborator_idstring

Collaborator ID — influencer or affiliate network identifier. You can find it in your Publisher Account > Partner Network > Influencers section.

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

Responses

OK.

Bodyapplication/json
Response
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": { "charge": {}, "description": null, "expiration": {}, "external_id": "lowcost", "grace_period": {}, "billing_retry": {}, "refund_period": null, "group_id": "newPlans", "id": 66001, "localized_name": null, "name": null, "project_id": 18404, "status": {}, "tags": null, "trial": {}, "type": "all" }, "product": null, "status": "active", "user": { "id": "jb1", "name": "J.Black" } }

Request

Lists all recurrent subscriptions.

Notice

This API method can’t be used under a high load. The maximum load is 20 requests per minute.

Notice

This API call does not contain the project_id path-parameter, so you need to use the API key that is valid in all the company’s projects to set up authorization.

Security
basicAuth
Path
merchant_idintegerrequired

Merchant ID.

Query
offsetinteger

Number of the element from which the list is generated (the count starts from 0).

limitintegerrequired

Limit for the number of elements on the page.

user_idstring

User ID.

project_id[]Array of integers

List of project IDs.

plan_id[]Array of integers

List of subscription plan IDs.

product_id[]Array of integers

List of product IDs the plans are linked to.

group_id[]Array of strings

List of group IDs the plans are linked to.

status[]Array of strings

Status.

Items Enum"active""canceled""non_renewing"
datetime_fromstring(datetime)

Sample date. Use this to find subscriptions created later than the request.

datetime_tostring(datetime)

Sample date. Use this to find subscriptions created later than the request.

curl -i -X GET \
  -u <username>:<password> \
  'https://xsolla.redocly.app/_mock/api/subscriptions/merchants/{merchant_id}/subscriptions?offset=0&limit=0&user_id=string&project_id%5B%5D=0&plan_id%5B%5D=0&product_id%5B%5D=0&group_id%5B%5D=string&status%5B%5D=active&datetime_from=string&datetime_to=string'

Responses

OK.

Bodyapplication/jsonArray [
idinteger

Subscription ID

planobject
plan.​project_idinteger

Project ID.

plan.​nameobject

Plan name. Value consists of pairs "localization":"plan name".

plan.​name.​enstring

English.

plan.​name.​rustring

Russian.

plan.​name.​csstring

Czech.

plan.​name.​arstring

Arabic.

plan.​name.​bgstring

Bulgarian.

plan.​name.​cnstring

Chinese (Simplified).

plan.​name.​twstring

Chinese (Traditional).

plan.​name.​frstring

French.

plan.​name.​destring

German.

plan.​name.​hestring

Hebrew.

plan.​name.​itstring

Italian.

plan.​name.​kostring

Korean.

plan.​name.​plstring

Polish.

plan.​name.​ptstring

Portuguese.

plan.​name.​rostring

Romanian.

plan.​name.​esstring

Spanish.

plan.​name.​thstring

Thai.

plan.​name.​trstring

Turkish.

plan.​name.​vistring

Vietnamese.

plan.​name.​jastring

Japanese.

plan.​chargeobject

Billing details.

plan.​charge.​periodobjectrequired

Billing period.

plan.​charge.​period.​valueintegerrequired

Number of time units. The value depends on the type parameter and can be:
- from 1 to 366, if type is day
- from 1 to 12, if type is month
- 0 if type is lifetime

plan.​charge.​period.​typestringrequired

Time unit. Can be day, month or lifetime.

Enum"day""month""lifetime"
plan.​charge.​amountnumber(float)

Billing amount.

plan.​charge.​currencystring

Currency of the purchase. Three-letter currency code per ISO 4217.

plan.​charge.​pricesArray of objects

List of prices in different currencies.

plan.​charge.​prices[].​amountnumber(float)required

Billing amount.

plan.​charge.​prices[].​currencystringrequired

Currency of the purchase. Three-letter currency code per ISO 4217.

plan.​charge.​prices[].​setup_feenumber(float)

One-time setup fee charged as part of the first invoice.

plan.​idinteger

Subscription plan ID.

plan.​external_idstring

Plan external ID (32 characters).

plan.​descriptionobject

Plan description. Value consists of pairs "localization":"plan description".

plan.​description.​enstring

English.

plan.​description.​rustring

Russian.

plan.​description.​csstring

Czech.

plan.​description.​arstring

Arabic.

plan.​description.​bgstring

Bulgarian.

plan.​description.​cnstring

Chinese (Simplified).

plan.​description.​twstring

Chinese (Traditional).

plan.​description.​frstring

French.

plan.​description.​destring

German.

plan.​description.​hestring

Hebrew.

plan.​description.​itstring

Italian.

plan.​description.​kostring

Korean.

plan.​description.​plstring

Polish.

plan.​description.​ptstring

Portuguese.

plan.​description.​rostring

Romanian.

plan.​description.​esstring

Spanish.

plan.​description.​thstring

Thai.

plan.​description.​trstring

Turkish.

plan.​description.​vistring

Vietnamese.

plan.​description.​jastring

Japanese.

plan.​group_idstring or null

Group ID the plan is linked to.

plan.​expirationobject

Subscription expiration details.

plan.​expiration.​valueinteger or nullrequired

Validity time.

plan.​expiration.​typestringrequired

Time unit. Can be day or month.

Enum"day""month"
plan.​trialobject

Trial period details.

plan.​trial.​valueintegerrequired

Number of time units.

plan.​trial.​typestringrequired

Time unit. Can be day.

Value"day"
plan.​grace_periodobject

Grace period details.

plan.​grace_period.​valueintegerrequired

Number of time units.

plan.​grace_period.​typestringrequired

Time unit. Can be day.

Value"day"
plan.​billing_retryobject

Billing retry details.

plan.​billing_retry.​valueintegerrequired

Number of billing retries.

plan.​refund_periodinteger or null

Period of time that user can refund the payment for a subscription plan (in days).

plan.​tagsArray of strings

Plan tags.

plan.​statusobject
plan.​status.​valuestring

Subscription plan status.

Enum"active""disabled"
userobject
user.​idstring

User ID

user.​namestring

User name

productobject or null
product.​idinteger or null

Product ID the plans are linked to.

product.​namestring

Product name.

product.​group_idstring

Group ID the product is linked to.

product.​descriptionobject

Localized item descriptions.

product.​description.​enstring

English.

product.​description.​rustring

Russian.

product.​description.​csstring

Czech.

product.​description.​arstring

Arabic.

product.​description.​bgstring

Bulgarian.

product.​description.​cnstring

Chinese (Simplified).

product.​description.​twstring

Chinese (Traditional).

product.​description.​frstring

French.

product.​description.​destring

German.

product.​description.​hestring

Hebrew.

product.​description.​itstring

Italian.

product.​description.​kostring

Korean.

product.​description.​plstring

Polish.

product.​description.​ptstring

Portuguese.

product.​description.​rostring

Romanian.

product.​description.​esstring

Spanish.

product.​description.​thstring

Thai.

product.​description.​trstring

Turkish.

product.​description.​vistring

Vietnamese.

product.​description.​jastring

Japanese.

charge_amountnumber(float)

Billing amount.

currencystring

Currency of the purchase. Three-letter currency code per ISO 4217.

date_createstring(datetime)

Subscription creation date in the YYYY-MM-DD’T’HH:MM:SS format per ISO 8601.

date_endstring(datetime)

Subscription end date in the YYYY-MM-DD’T’HH:MM:SS format per ISO 8601.

date_last_chargestring or null(datetime)

Last subscription charge date in the YYYY-MM-DD’T’HH:MM:SS format per ISO 8601.

date_next_chargestring or null(datetime)

Next subscription charge date in the YYYY-MM-DD’T’HH:MM:SS format per ISO 8601.

statusstring

Status

Enum"new""active""canceled""non_renewing""freeze"
commentstring

Reason for changing subscription status

]
Response
application/json
[ { "id": 45, "status": "canceled", "user": {}, "charge_amount": 0.03, "currency": "USD", "date_create": "2013-09-05T15:27:47+04:00", "date_end": "2014-02-06T11:32:48+04:00", "date_last_charge": null, "date_next_charge": null, "plan": {}, "product": {} } ]
Operations
Operations
Operations
Operations