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

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.

Security
basicAuth
Path
merchant_idintegerrequired

Merchant ID.

Bodyapplication/jsonrequired
userobject

User details.

Example: {"country":{"allow_modify":true,"value":"US"},"age":19,"email":{"value":"john.smith@mail.com"},"id":{"value":"user_2"},"name":{"value":"John Smith"}}
settingsobject

Custom project settings.

Example: {"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"}}
purchaseobject

Object containing purchase details.

Example: {"checkout":{"currency":"USD","amount":10},"subscription":{"gift":{"recipient":"test_recipient_v1","email":"recipient_email@email.com"}}}
custom_parametersobject

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.

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"
      }
    }
  }'

Responses

Created.

Bodyapplication/json
tokenstring
Response
application/json
{ "token": "eop57k1boA7nnYPtewZ6KEXJyJADEwRT" }
Operations
Operations
Operations
Operations
Operations
Operations
Operations