Skip to content

Managing Subscriptions

Backendless provides two APIs for Android platform that allow retrieving the current subscription status of an application, and also cancelling an active subscription.

Retrieve Subscription Status

The method below returns basic information associated with an active subscription such as:

  • next renewal time.
  • initial subscription time.
  • expiry time.

Method

GET

Endpoint URL

Important

Make sure to replace xxxx in the domain name in the sample requests below to the one assigned to your application.

GET https://xxxx.backendless.app/commerce/googleplay/[packageName]/subscription/[subscriptionId]/purchases/[token]

where:

Argument                Description
[packageName] A package name of the application associated with an active in-app subscription purchase. (for example, 'com.some.thing').
[productId] ID of the purchased subscription (for example, 'com.some.thing.monthly001' - where monthly001 is the ID).
[token] A token provided to the application after the subscription purchase.

Request Headers

None.

Request Body

None.

Response Body

Returns the GooglePlaySubscriptionStatus object:

{  
  "autoRenewing": boolean,  
  "startTimeMillis": long,  
  "kind": string,  
  "expiryTimeMillis": long  
}

where:

Argument                Description
autoRenewing Indicates whether the next subscription is set for automatic renewal.
startTimeMillis Time when a subscription was purchased. Time is measured in milliseconds passed since the Unix epoch (1 January 1970 00:00:00 UT).
kind Represents the inappPurchase object in the androidpublisher service.
expiryTimeMillis Time when a subscription expires. Time is measured in milliseconds passed since the Unix epoch (1 January 1970 00:00:00 UT).

Cancel Subscription

This API cancels an active subscription.

Method

POST

Endpoint URL

Important

Make sure to replace xxxx in the domain name in the sample requests below to the one assigned to your application.

POST https://xxxx.backendless.app/commerce/googleplay/[packageName]/subscription/[subscriptionId]/purchases/[token]/cancel

where:

Argument                Description
[packageName] A package name of the application associated with an active in-app subscription purchase. (for example, 'com.some.thing').
[productId] ID of the purchased subscription (for example, 'com.some.thing.monthly001' - where monthly001 is the ID).
[token] A token provided to the application after the subscription purchase.

Request Headers

None.

Request Body

None.

Response Body

None.