aisplice

API reference

Xsolla verification

POST/v1/xsolla/verify

Checks whether an Xsolla user, or one subscription, is subscribed, with the merchant ID, project ID and Xsolla API key set on this API key (console → API keys → Edit → Xsolla subscription check). The answer comes straight from Xsolla; the gateway bills nothing and your app decides what to unlock. Found subscriptions are cached for one minute.

#Request parameters

  • user_idstringoptional

    The user.id your app put into the Xsolla payment token. Required unless subscription_id is sent.

  • subscription_idintegeroptional

    An Xsolla subscription ID, if the app has one. Sent together with user_id, the subscription must belong to that user.

subscribed is true for any real subscription of this user in the project, including canceled ones; active is true only while it may be used. With auto-renew off (state non_renewing) a subscription stays active until expiry_time. in_trial is true while it has not been charged yet. A user without a subscription answers subscribed false and state not_found with status 200. When a user has several, the active one that runs longest is returned.

Every call, including cached answers and failures, appears in Console → Request logs as a free xsolla-verify row on the key that made it. These rows are left out of request counts. Xsolla subscriptions in your app →

#Related errors

  • 400 invalid_requestThe body is not JSON, or user_id and subscription_id are both missing.
  • 400 xsolla_not_configuredThis API key has no Xsolla merchant ID, project ID and API key yet.
  • 401Invalid or missing bearer token.
  • 429Per-key limit on verify calls: 120 per minute by default, raised for a key by support. Wait for Retry-After and keep the last answer.
  • 502 xsolla_credentials_invalidXsolla rejected the stored API key. Enter a new one on the key.
  • 503 xsolla_unavailableXsolla did not answer in time. Retry after a few seconds.

Full error-code table →

#Request example

curl https://www.aisplice.store/v1/xsolla/verify \
  -H "Authorization: Bearer sk-YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"user_id": "USER_ID_IN_THE_PAYMENT_TOKEN"}'

#Response

response.json
{
  "project_id": 273204,
  "subscribed": true,
  "active": true,
  "in_trial": false,
  "state": "active",
  "subscription_id": 249579,
  "user_id": "user-8f2c",
  "plan_id": 601,
  "plan_external_id": "weekly",
  "expiry_time": 1793000000,
  "auto_renewing": true,
  "checked_at": 1790400000
}

Still stuck?

Send us the request ID or the error message and we will look into it.