Skip to main content

Cancelling Purchase

This method allows you to cancel a purchase (i.e., cancel the hold on the user's card funds) by using the purchase and application identifiers. It applies only to two-stage purchases in the PAID status.

tip

If you don't know where to start, read the guide in the usage scenarios.

Interaction Parameters​

For real purchases:

PUT
https://public-api-m.rustore.ru/public/applications/{appId}/purchases/{purchaseId}:cancel

For test purchases:

PUT
https://public-api-m.rustore.ru/public/sandbox/applications/{appId}/purchases/{purchaseId}:cancel
AttributeTypeDescriptionMandatoryLocationExample
Public-TokenstringJWE authorization token for the RuStore Public API.
How to get an authorization token.
YesheaderN/A
appIdnumberThe application ID from the RuStore Console.
1. Go to the Applications tab and select the desired application.
2. Copy the ID from the application page URL — it is the set of digits between apps/ and /versions.
Yespath1704024
purchaseIdstringThe purchase identifier in UUID format. It can be obtained from the purchase result via the SDK, from the server notification, or by querying purchase information.Yespath3aa0c7bd-964e-4562-b218-fe365adb4ae3
note

The server response time for this request can take up to 30 seconds. We recommend setting the read timeout value in your HTTP client to at least 30 seconds.

Response Parameters​

AttributeTypeDescriptionMandatoryLocationExample
codestringResponse code.YesbodyOK, ERROR, BAD_REQUEST, NOT_FOUND, etc.
messagestringExplanation of the response code.NobodyPurchase status must be PAID
bodyobjectResponse body.Nobody{}
timestampstringResponse time.Yesbody2025-04-01T15:02:09.427Z

Successful Response Example​

{
"code": "OK",
"message": null,
"body": {},
"timestamp": "2025-04-01T15:02:09.427Z"
}

Error Response Example​

{
"code": "ERROR",
"message": "Purchase status must be PAID",
"body": null,
"timestamp": "2025-04-01T15:02:09.427Z"
}

Error List​

MessageDescription
Purchase status must be PAIDThe purchase status must be PAID. Make sure that the correct purchase identifier is provided.
Purchase not foundPurchase not found. Make sure that the correct purchase identifier is provided.
ForbiddenForbidden. Check the validity of the authorization token and the request parameters.
Something went wrongSomething went wrong. Please try again later or contact support.