Developer API

Subscription Validation

This function returns status, start date, and expiration date of a subscription.<package_name>/subscriptions/<subscription_id>/purchases/<purchase_token>/

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.

The result will look similar to:

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

The description of each field is as followed:

Name Description
kind Type of the returned resource. This will always be androidpublisher#subscriptionPurchase
initiationTimestampMsec Time of the initiation of subscription as milliseconds from EPOCh (1970/1/1).
validUntilTimestampMsec Time 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.
autoRenewing A 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 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!",

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.