Skip to main content

Cancel a subscription

Important

This method works only with subscriptions made through Pay SDK.

This method cancels a subscription by the purchase ID. The canceled subscription will end on the paid period end date with no further charges.

tip

You can manage subscriptions in the RuStore Console. For details, see the subscription management section.

Interaction parameters

For real purchases:

PATCH
https://public-api.rustore.ru/public/v1/applications/{appId}/subscriptions/{purchaseId}:cancel

For test purchases:

PATCH
https://public-api.rustore.ru/public/sandbox/v1/applications/{appId}/subscriptions/{purchaseId}:cancel 
AttributeTypeDescriptionRequiredLocationExample
Public-TokenstringJwe token to Public API Rustore.
How to get an authorization token.
YesheaderN/A
appIdnumberApplication ID from the RuStore Console where the refund is performed.
1. Go to the Applications tab and select the required app.
2. Copy the ID from the app page URL — it is the sequence of digits between apps/ and /versions.
For example, in https://console.rustore.ru/apps/123456/versions the app ID is 123456.
Yespath5135162
purchaseIdstringPurchase identifier in UUID format. You can get it from the purchase result via the SDK, from a server notification, or by requesting purchase info. For details, see Manage subscriptions.Yespath19b873b0-a3a9-4578-be99-1ed0fc8a73d0

Response parameters

AttributeTypeDescriptionRequiredLocationExample
codestringResponse code.YesbodyOK
messagestringOperation result message.NobodySuccessful result
bodyobjectResponse body.Nobody{}
timestampstringServer response timestamp.Yesbody2025-07-22T07:59:53.211Z

Response examples

Successful response:

{
"code": "OK",
"message": null,
"body": null,
"timestamp": "2025-07-28T16:09:03.831Z"
}

Error response:

{
"code": "ERROR",
"message": "Subscription not found for given purchaseId",
"body": null,
"timestamp": "2025-07-22T07:59:53.216Z"
}

Error list

MessageExplanation
Subscription not foundSubscription not found. Verify the purchase identifier.
Incorrect parameter appId / Incorrect parameter purchaseIdInvalid request parameters. Check the app identifier and the purchase identifier.
ForbiddenAccess denied. Verify the authorization token and access rights.
Something went wrongSomething went wrong. Try again later or contact support.
Too Many RequestsRate limit exceeded. Try again later.
Internal Server ErrorInternal server error. Try again later.