Getting subscription data
This method allows retrieving subscription info using a subscription token.
Interaction parameters
GET
https://public-api.rustore.ru/public/subscription/{subscriptionToken}
Attribute | Type | Description | Required | Location | Example |
---|---|---|---|---|---|
Public-Token | string | Jwe token to Public API Rustore How to get an authorization token. | Yes | header | N/A |
subscriptionToken | string | How to get a subscription token Billing SDK Documentation. | Yes | path | 111.123 |
Response example
Attribute | Type | Description | Required | Location | Example |
---|---|---|---|---|---|
code | number | Response code | Yes | body | • ОК ;• ERROR ;• BAD_REQUEST ;• NOT_FOUND . |
message | date | Decoded response code | No | body | Jwe token is expired |
body{} | object | Response body | No | body | N/A |
timestamp | string | Response time | Yes | body | 2023-08-02T10:11:04.655684723+03:00 |
body{}
Attribute | Type | Description | Required | Location | Example |
---|---|---|---|---|---|
code | number | Response code | Yes | body | 0 |
success | boolean | Response success flag | Yes | body | true |
message | string | Decoded response code | No | body | Unknown error |
body{} | object | Response body | No | body | N/A |
body.body{}
Attribute | Type | Description | Example |
---|---|---|---|
serviceName | string | Service name | Okko |
subscriptionId | integer | Unique subscription ID | 12345 |
addParameters | string | Additional subscription options | Something about subscription |
productType | string | Product type. | SUBSCRIPTION |
productName | string | Product name | Okko optimum |
productCode | string | Product code. | monthly_sub |
recurrent | boolean | Recurrency sign | true |
countOfDay | integer | Number of days | 10 |
periodType | string | Period type. | Available values: • DAY ;• MONTH ;• YEAR . |
periodDuration | integer | Period duration | 10 |
nextPaymentDate | string | Next payment date | 2021-03-23 |
price | integer | Price in minimum currency unit (kopecks) | 9999 |
currency | string | Currency. | RUB |
imageUrl | string | Link to product picture | N/A |
state | string | Subscription status | Available 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. |
currentPeriod | string | Current 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. |
debtPaymentPeriod | string | Name of payment period | Null if the period is standard. |
description | string | Subscription product description | Description |
tariffId | integer | Unique rate ID | 12345 |
periods [] | array[object] | Current period info | More details. |
body.body.periods []
Attribute | Type | Description | Example |
---|---|---|---|
periodName | string | Current period. | Available values: • PROMO ;• START ;• STANDARD ;• GRACE ;• HOLD . |
periodType | string | Period type. | Available values: • DAY ;• MONTH ;• YEAR . |
periodDuration | number | Period duration | 10 |
periodPrice | number | Price in minimum currency unit | 10000 |
nextPeriod | string | Next period name | Available 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.