Developer API
Subscription Cancellation
This function cancels a subscription.
https://pardakht.cafebazaar.ir/devapi/v2/api/applications/<package_name>/subscriptions/<subscription_id>/purchases/<purchase_token>/cancel/
You should fill the values in the angle brackets according to your request:
Name | Expected Value |
---|---|
package_name | Package name of the app in which product of the request subscription is defined. |
subscription_id | SKU of the subscription product. |
purchase_token | Purchase token returned by Bazaar to app when subscription started. You can also use the token of any of the further billings of that subscription. |
Note that you need a valid access_token to use this method.
If subscription is successfully cancelled, the result will be an empty JSON object:
{}
In case of an error, you'll recieve a response with 40X status code, with a body of JSON object containing an error field which specifies the error and anerror_description field explaining the cause of error. For example, if the requested subscription is not found, the response would have a 404 status code and this content:
{
"error": "not_found",
"error_description": "The requested subscription is not found!",
}
If the subscription is cancelled or expired, or the product is not found, the request will result in an error, as mentioned earlier, with a value of invalid_value for error.