Print

This function returns status, start date, and expiration date of a subscription.

https://pardakht.cafebazaar.ir/devapi/v2/api/applications/<package_name>/subscriptions/<subscription_id>/purchases/<purchase_token>/


You should fill the values in the angle brackets according to your request:

NameExpected Value
package_namePackage name of the app in which product of the request subscription is defined.
subscription_idSKU of the subscription product.
purchase_tokenPurchase 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.

The result will look similar to:

{
        "kind": "androidpublisher#subscriptionPurchase",
        "initiationTimestampMsec": 1414181378566,
        "validUntilTimestampMsec": 1435912745710,
        "autoRenewing": true,
}

The description of each field is as followed:

NameDescription
kindType of the returned resource. This will always be androidpublisher#subscriptionPurchase
initiationTimestampMsecTime of the initiation of subscription as milliseconds from EPOCh (1970/1/1).
validUntilTimestampMsecTime of the next anticipated billing as milliseconds from EPOCh (1970/1/1). For subscriptions that don't automatically renew, this is when the subscription ends.
autoRenewingA boolean value representing whether next billings occur automatically or not.

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 an error_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!",
}

Notice: You can be sure that requested subscription is not done, only when error is equal to not_found. A successful response does not guarantee that the user is subscribed to the product, as this method returns information of the expired subscriptions too. To be sure, you need to compare validUntilTimestampMsec with current time.

Was this content helpful?
Write your comment here...

If you have any comment on this content or any idea to make it better, use this form to send us your comment.

Publish Date: 1400-03-29 08:24

Latest Update: 1400-04-14 06:56