Skip to main content

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}
AttributeTypeDescriptionRequiredLocationExample
Public-TokenstringJWE authorization token for the RuStore Public API.
How to obtain an authorization token
YesheaderN/A
packageNamestringApplication package name.Yespathcom.MashaAndTheBear.HairSalon
subscriptionIdstringSubscription product code.
Specified by the developer when creating the product in the RuStore Console.

How to create a subscription.
Yespathdaily_sub
purchaseIdstringPurchase identifier in UUID format. Can be obtained from the SDK purchase result, from a server notification, or by requesting purchase information.Yespath3aa0c7bd-964e-4562-b218-fe365adb4ae3

Response parameters

AttributeTypeDescriptionRequiredLocationExample
codestringResponse code.YesbodyOK / ERROR
messagestringDescription of the response code.NobodyBad request
body{}objectResponse body.NobodyN/A
timestampstringResponse timestamp.Yesbody2024-07-29T12:00:00.000Z

body{}

AttributeTypeDescriptionRequiredExample
startTimeMillisstringSubscription start time in milliseconds since epoch.Yes1694431707000
expiryTimeMillisstringSubscription expiration time in milliseconds since epoch.Yes1697083457000
autoRenewingbooleanIndicates whether the subscription will automatically renew when the current term expires.Yesfalse
developerPayloadstringString with additional order information, which you can set when confirming the purchase in the SDK.NoExternal id = 1
priceCurrencyCodestringISO 4217 currency code for the subscription price.YesRUB
priceAmountMicrosstringSubscription 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.Yes749000000
countryCodestringCountry/region code of the user's billing address at the time the subscription was granted.YesRU
paymentStatenumberSubscription payment state. Possible values:
0 — payment pending
1 — payment received
2 — free trial.

Omitted for canceled subscriptions with expired term.
No, only for active subscriptions1
cancelReasonnumberReason 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 CLOSED0
userCancellationTimeMillisstringTime the subscription was canceled by the user in milliseconds since epoch.No, only for canceled subscriptions with status CLOSED1697083457000
orderIdstringIdentifier 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.Yes3352..1
acknowledgementStatenumberSubscription product acknowledgment state. Possible values:
0 — not yet acknowledged
1 — acknowledged
Yes1
externalAccountIdstringUser identifier in an external application.No, only if appUserId was set at purchase startany_string
kindstringAlways androidpublisher#subscriptionPurchase.Yesandroidpublisher#subscriptionPurchase
purchaseTypenumberPurchase type: 0 — test subscription.No, only for test subscriptions; not returned for real subscriptions0
introductoryPriceInfo{}objectInformation 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 subscriptionsee below
promoPriceInfo{}objectInformation 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 configuredsee below

introductoryPriceInfo{}

AttributeTypeDescriptionExample
introductoryPriceCurrencyCodestringISO 4217 currency code for the introductory price.RUB
introductoryPriceAmountMicrosstringPeriod cost in micros. For a trial period, the value is 0.0
introductoryPricePeriodstringPromo period duration in ISO-8601 format (P1W, P1M, P3M, P6M, P1Y).P1Y
introductoryPriceCyclesstringNumber of billing cycles for the offer.1

promoPriceInfo{}

AttributeTypeDescriptionExample
promoPriceCurrencyCodestringISO 4217 currency code for the promo price.RUB
promoPriceAmountMicrosstringPeriod cost in micros.59900000
promoPricePeriodstringPromo period duration in ISO-8601 format (P1W, P1M, P3M, P6M, P1Y).P1Y
promoPriceCyclesstringNumber 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

MessageDescription
Purchase not foundPurchase not found. Make sure you specified the correct purchase identifier.
ForbiddenAccess is denied. Check the validity of the authorization token and the request parameters.
Something went wrongAn unexpected error occurred. Try again later or contact support.