Skip to main content

Getting subscription data

This method allows retrieving subscription info using a subscription token.

Interaction parameters

GET

https://public-api.rustore.ru/public/subscription/{subscriptionToken}

AttributeTypeDescriptionRequiredLocationExample
Public-TokenstringJwe token to Public API Rustore
How to get an authorization token.
YesheaderN/A
subscriptionTokenstringHow to get a subscription token Billing SDK Documentation.Yespath111.123

Response example

AttributeTypeDescriptionRequiredLocationExample
codenumberResponse codeYesbodyОК;
ERROR;
BAD_REQUEST;
NOT_FOUND.
messagedateDecoded response codeNobodyJwe token is expired
body{}objectResponse bodyNobodyN/A
timestampstringResponse timeYesbody2023-08-02T10:11:04.655684723+03:00

body{}

AttributeTypeDescriptionRequiredLocationExample
codenumberResponse codeYesbody0
successbooleanResponse success flagYesbodytrue
messagestringDecoded response codeNobody Unknown error
body{}objectResponse bodyNobodyN/A

body.body{}

AttributeTypeDescriptionExample
serviceNamestringService nameOkko
subscriptionIdintegerUnique subscription ID12345
addParametersstringAdditional subscription optionsSomething about subscription
productTypestringProduct type.SUBSCRIPTION
productNamestringProduct nameOkko optimum
productCodestringProduct code.monthly_sub
recurrentbooleanRecurrency signtrue
countOfDayintegerNumber of days10
periodTypestringPeriod type.Available values:
DAY;
MONTH;
YEAR.
periodDurationintegerPeriod duration10
nextPaymentDatestringNext payment date2021-03-23
priceintegerPrice in minimum currency unit (kopecks)9999
currencystringCurrency.RUB
imageUrlstringLink to product pictureN/A
statestringSubscription statusAvailable values:
ACTIVATED — active subscription.

Interim Statuses
ACCEPTED — awaiting payment;
DEPOSITED — payment has been made, subscription awaiting activation;
CLOSE_PENDING — subscription is in the process of being closed;
REPEATING — subscription is in the process of renewal, an attempt is made to charge money for renewal.

Final Statuses
DECLINED — subscription closed, all attempts at regular subscription payments failed, GRACE and HOLD periods and number of renewal attempts expired;
CANCELED — user has not paid for subscription;
CLOSED — subscription is closed; user has switched off the subscription auto-renewal, the paid period has expired, provider has confirmed that subscription was closed;
REFUNDED — refund to the user has been initiated.
currentPeriodstringCurrent period.**Available values: **
PROMO — free period;
START — discounted start period;
STANDARD — standard period;
GRACE — grace period, user has not paid for the subscription, debit attempts continue, access is retained;
HOLD — hold period, user has not paid for the subscription, debit attempts continue, access must be terminated.
debtPaymentPeriodstringName of payment periodNull if the period is standard.
descriptionstringSubscription product descriptionDescription
tariffIdintegerUnique rate ID12345
periods []array[object]Current period infoMore details.

body.body.periods []

AttributeTypeDescriptionExample
periodNamestringCurrent period.Available values:
PROMO;
START;
STANDARD;
GRACE;
HOLD.
periodTypestringPeriod type.Available values:
DAY;
MONTH;
YEAR.
periodDurationnumberPeriod duration10
periodPricenumberPrice in minimum currency unit10000
nextPeriodstringNext period nameAvailable values:
PROMO;
START;
STANDARD;
GRACE;
HOLD.

Response example

"code":"200",
"message":"something",
"timestamp":"2023-08-02T10:11:04.655684723+03:00",
"body":
{
"code": 40401,
"success": false,
"message": "unknown error",
"body": {
"serviceName": "Okko",
"subscriptionId": 100500,
"addParameters": "something",
"productType": "string",
"productName": "ОККО Optimum",
"productCode": "string",
"recurrent": true,
"countOfDay": 100,
"periodType": "DAY",
"periodDuration": 30,
"nextPaymentDate": "2021-03-23",
"price": 999,
"currency": "RUB",
"imageUrl": "https://static-eu.insales.ru/images/products/1/7435/306650379/thumb_1586524817849_15832463664565053990106868.jpg",
"state": "ACTIVATED",
"currentPeriod": "STANDARD",
"debtPaymentPeriod": "string",
"description": "Description",
"tariffId": 100500,
"periods": [
{
"periodName": "STANDARD",
"periodType": "DAY",
"periodDuration": 10,
"periodPrice": 10000,
"nextPeriod": "STANDARD"
}
]
}
}

Error response

{
"code": "ERROR",
"message": "Jwe token is expired",
"body": null,
"timestamp": "2024-01-21T13:51:59.654427798+03:00"
}

Response verification

The security token is generated by the security token method and then verified while getting the response:

  • Owner and/or app should not be blocked;

  • Token should be valid;

  • application_code invoice should contain the application code which corresponds to the token owner.