Merchant ID.
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.
Request
You can create a token with arbitrary user parameters. You send these parameters when obtaining the token and receive them back after a successful payment. A token can only contain parameters either described in this document or predefined by you.
If any parameter is sent in the wrong format or has the wrong type, no token will be issued. You will receive a 422 HTTP code with the error description in the JSON body. In extended_message you will receive an information what exact parameters have been sent incorrectly.
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.
User details.
Custom project settings.
Object containing purchase details.
You can pass additional parameters in the token in the custom_parameters object to configure anti-fraud filters. The recommended parameters are shown in the drop-down list. See Pay Station documentation.
- Mock serverhttps://xsolla.redocly.app/_mock/api/subscriptions/merchants/{merchant_id}/token
- https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/token
- 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/merchants/{merchant_id}/token' \
-H 'Content-Type: application/json' \
-d '{
"purchase": {
"checkout": {
"currency": "USD",
"amount": 10
},
"subscription": {
"gift": {
"recipient": "test_recipient_v1",
"email": "recipient_email@email.com"
}
}
},
"settings": {
"currency": "USD",
"language": "en",
"project_id": 16184,
"ui": {
"components": {
"virtual_currency": {
"custom_amount": true
}
},
"desktop": {
"virtual_item_list": {
"button_with_price": true,
"layout": "list"
}
},
"size": "medium"
}
},
"user": {
"country": {
"allow_modify": true,
"value": "US"
},
"age": 19,
"email": {
"value": "john.smith@mail.com"
},
"id": {
"value": "user_2"
},
"name": {
"value": "John Smith"
}
}
}'{ "token": "eop57k1boA7nnYPtewZ6KEXJyJADEwRT" }