Getting Subscription Data (V4)
Important
This method works only with subscriptions made through Pay SDK.
This method allows you to get subscription information for a user by purchase identifier.
tip
If you are not sure where to start, read the usage scenarios guide.
Interaction Parameters
For real subscriptions:
GET
https://public-api.rustore.ru/public/v4/subscription/{packageName}/{subscriptionId}/{purchaseId}
For test subscriptions use other method:
GET
https://public-api.rustore.ru/public/sandbox/v4/subscription/{packageName}/{subscriptionId}/{purchaseId}
| Attribute | Type | Description | Required | Location | Example |
|---|---|---|---|---|---|
Public-Token | string | JWE authorization token for the RuStore Public API. How to obtain an authorization token | Yes | header | N/A |
packageName | string | Application package name. | Yes | path | com.MashaAndTheBear.HairSalon |
subscriptionId | string | Subscription product code. Specified by the developer when creating the product in the RuStore Console. How to create a subscription. | Yes | path | daily_sub |
purchaseId | string | Purchase identifier in UUID format. Can be obtained from the SDK purchase result, from a server notification, or by requesting purchase information. | Yes | path | 3aa0c7bd-964e-4562-b218-fe365adb4ae3 |
Response parameters
| Attribute | Type | Description | Required | Location | Example |
|---|---|---|---|---|---|
code | string | Response code. | Yes | body | OK / ERROR |
message | string | Description of the response code. | No | body | Bad request |
body{} | object | Response body. | No | body | N/A |
timestamp | string | Response timestamp. | Yes | body | 2024-07-29T12:00:00.000Z |
body{}
| Attribute | Type | Description | Required | Example |
|---|---|---|---|---|
startTimeMillis | string | Subscription start time in milliseconds since epoch. | Yes | 1694431707000 |
expiryTimeMillis | string | Subscription expiration time in milliseconds since epoch. | Yes | 1697083457000 |
autoRenewing | boolean | Indicates whether the subscription will automatically renew when the current term expires. | Yes | false |
developerPayload | string | String with additional order information, which you can set when confirming the purchase in the SDK. | No | External id = 1 |
priceCurrencyCode | string | ISO 4217 currency code for the subscription price. | Yes | RUB |
priceAmountMicros | string | Subscription price in micros, where 1,000,000 micros represent one currency unit. For example, if the subscription price is 100 rubles, priceAmountMicros will be 100000000. | Yes | 749000000 |
countryCode | string | Country/region code of the user's billing address at the time the subscription was granted. | Yes | RU |
paymentState | number | Subscription payment state. Possible values: • 0 — payment pending • 1 — payment received • 2 — free trial.Omitted for canceled subscriptions with expired term. | No, only for active subscriptions | 1 |
cancelReason | number | Reason the subscription was canceled. Possible values: • 0 — canceled by user • 1 — canceled by system (e.g., due to payment issue) • 3 — canceled by developer | No, only for canceled subscriptions with status CLOSED | 0 |
userCancellationTimeMillis | string | Time the subscription was canceled by the user in milliseconds since epoch. | No, only for canceled subscriptions with status CLOSED | 1697083457000 |
orderId | string | Identifier of the latest invoice associated with the subscription purchase. If there are multiple invoices for the subscription, their count is appended after .. starting from 0. | Yes | 3352..1 |
acknowledgementState | number | Subscription product acknowledgment state. Possible values: • 0 — not yet acknowledged • 1 — acknowledged | Yes | 1 |
externalAccountId | string | User identifier in an external application. | No, only if appUserId was set at purchase start | any_string |
kind | string | Always androidpublisher#subscriptionPurchase. | Yes | androidpublisher#subscriptionPurchase |
purchaseType | number | Purchase type: 0 — test subscription. | No, only for test subscriptions; not returned for real subscriptions | 0 |
introductoryPriceInfo{} | object | Information about the introductory (free) period of the subscription. This field does not indicate that the subscription is currently in the trial period. | No, only if a trial period is configured for the subscription | see below |
promoPriceInfo{} | object | Information about the promotional period of the subscription. This field is populated only if a promo period is configured. It does not indicate that the subscription is currently in the promo period. | No, only if a promo period is configured | see below |
introductoryPriceInfo{}
| Attribute | Type | Description | Example |
|---|---|---|---|
introductoryPriceCurrencyCode | string | ISO 4217 currency code for the introductory price. | RUB |
introductoryPriceAmountMicros | string | Period cost in micros. For a trial period, the value is 0. | 0 |
introductoryPricePeriod | string | Promo period duration in ISO-8601 format (P1W, P1M, P3M, P6M, P1Y). | P1Y |
introductoryPriceCycles | string | Number of billing cycles for the offer. | 1 |
promoPriceInfo{}
| Attribute | Type | Description | Example |
|---|---|---|---|
promoPriceCurrencyCode | string | ISO 4217 currency code for the promo price. | RUB |
promoPriceAmountMicros | string | Period cost in micros. | 59900000 |
promoPricePeriod | string | Promo period duration in ISO-8601 format (P1W, P1M, P3M, P6M, P1Y). | P1Y |
promoPriceCycles | string | Number of billing cycles for the promotional offer. | 1 |
Example of a successful response
{
"code": "OK",
"message": "Successful result",
"body": {
"startTimeMillis": "1694431707000",
"expiryTimeMillis": "1697083457000",
"autoRenewing": true,
"developerPayload": "External id = 1",
"priceCurrencyCode": "RUB",
"priceAmountMicros": "749000000",
"countryCode": "RU",
"paymentState": 1,
"cancelReason": 0,
"userCancellationTimeMillis": "1697083457000",
"orderId": "3352..1",
"acknowledgementState": 1,
"externalAccountId": "any_string",
"kind": "androidpublisher#subscriptionPurchase",
"purchaseType": 0,
"introductoryPriceInfo": {
"introductoryPriceCurrencyCode": "RUB",
"introductoryPriceAmountMicros": "0",
"introductoryPricePeriod": "P1Y",
"introductoryPriceCycles": "1"
},
"promoPriceInfo": {
"promoPriceCurrencyCode": "RUB",
"promoPriceAmountMicros": "59900000",
"promoPricePeriod": "P1Y",
"promoPriceCycles": "1"
}
},
"timestamp": "2025-08-11T14:16:02.236Z"
}
Example of an error Response
{
"code": "ERROR",
"message": "Bad request",
"body": null,
"timestamp": "2024-07-29T12:00:00.000Z"
}
Error list
| Message | Description |
|---|---|
Purchase not found | Purchase not found. Make sure you specified the correct purchase identifier. |
Forbidden | Access is denied. Check the validity of the authorization token and the request parameters. |
Something went wrong | An unexpected error occurred. Try again later or contact support. |