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
| 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 |
appId | number | Application 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. | Yes | path | 5135162 |
purchaseId | string | Purchase 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. | Yes | path | 19b873b0-a3a9-4578-be99-1ed0fc8a73d0 |
Response parameters
| Attribute | Type | Description | Required | Location | Example |
|---|---|---|---|---|---|
code | string | Response code. | Yes | body | OK |
message | string | Operation result message. | No | body | Successful result |
body | object | Response body. | No | body | {} |
timestamp | string | Server response timestamp. | Yes | body | 2025-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
| Message | Explanation |
|---|---|
| Subscription not found | Subscription not found. Verify the purchase identifier. |
| Incorrect parameter appId / Incorrect parameter purchaseId | Invalid request parameters. Check the app identifier and the purchase identifier. |
| Forbidden | Access denied. Verify the authorization token and access rights. |
| Something went wrong | Something went wrong. Try again later or contact support. |
| Too Many Requests | Rate limit exceeded. Try again later. |
| Internal Server Error | Internal server error. Try again later. |