Creates a subscription plan.
Subscriptions API (2.0)
- 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.
Plan name. Value consists of pairs "localization":"plan name".
Billing details.
Billing period.
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
Currency of the purchase. Three-letter currency code per ISO 4217.
Period of time that user can refund the payment for a subscription plan (in days).
- Mock serverhttps://xsolla.redocly.app/_mock/api/subscriptions/projects/{project_id}/subscriptions/plans
- https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X POST \
-u <username>:<password> \
'https://xsolla.redocly.app/_mock/api/subscriptions/projects/{project_id}/subscriptions/plans' \
-H 'Content-Type: application/json' \
-d '{
"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
},
"billing_retry": {
"value": 1
},
"refund_period": null,
"name": {
"en": "Experience boost"
},
"status": {
"value": "active"
},
"trial": {
"type": "day",
"value": 7
}
}'{ "external_id": "exp", "plan_id": 241082 }
- Mock serverhttps://xsolla.redocly.app/_mock/api/subscriptions/projects/{project_id}/subscriptions/plans
- https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X GET \
-u <username>:<password> \
'https://xsolla.redocly.app/_mock/api/subscriptions/projects/{project_id}/subscriptions/plans?plan_id=0&limit=0&offset=0&external_id=string&group_id=string&product_id=0&query=string'[ { "charge": { … }, "description": { … }, "expiration": { … }, "external_id": "3b355320", "grace_period": { … }, "billing_retry": { … }, "refund_period": null, "group_id": null, "id": 241037, "localized_name": "Platinum VIP", "name": { … }, "project_id": 40797, "status": { … }, "tags": [], "trial": { … } }, { "charge": { … }, "description": { … }, "expiration": { … }, "external_id": "0fe1b6fc", "grace_period": { … }, "billing_retry": { … }, "refund_period": null, "group_id": null, "id": 241038, "localized_name": "Gold Status", "name": { … }, "project_id": 40797, "status": { … }, "tags": [], "trial": { … } } ]
Trial period details. If this parameter is not passed, the default values (0 days) are used.
Period of time that user can refund the payment for a subscription plan (in days).
- Mock serverhttps://xsolla.redocly.app/_mock/api/subscriptions/projects/{project_id}/subscriptions/plans/{plan_id}
- https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans/{plan_id}
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X PUT \
-u <username>:<password> \
'https://xsolla.redocly.app/_mock/api/subscriptions/projects/{project_id}/subscriptions/plans/{plan_id}' \
-H 'Content-Type: application/json' \
-d '{
"charge": {
"amount": 20,
"currency": "USD",
"period": {
"type": "month",
"value": 1
},
"prices": [
{
"amount": 17,
"currency": "EUR",
"setup_fee": 1.5
},
{
"amount": 2000,
"currency": "JPY",
"setup_fee": 2.5
}
]
},
"description": {
"en": "3x more experience!"
},
"expiration": {
"type": "day",
"value": null
},
"external_id": "exp",
"grace_period": {
"type": "day",
"value": 2
},
"billing_retry": {
"value": 1
},
"refund_period": null,
"name": {
"en": "Experience boost"
},
"tags": [],
"trial": {
"type": "day",
"value": 7
}
}'{ "charge": { "amount": 20, "currency": "USD", "period": { … }, "prices": [ … ] }, "description": { "en": "3x more experience!" }, "expiration": { "type": "day", "value": 0 }, "external_id": "exp", "grace_period": { "type": "day", "value": 2 }, "billing_retry": { "value": 1 }, "refund_period": null, "group_id": null, "id": 241082, "localized_name": "Experience boost", "name": { "en": "Experience boost" }, "project_id": 40797, "status": { "value": "active" }, "tags": [], "trial": { "type": "day", "value": 7 }, "type": "all" }