question

ralle538 avatar image
ralle538 asked

Recover subscription / PurchaseUpdatesRequest

We are currently implementing two subscriptions (3 months, 12 months) in our application. One use case/test case would be to restore subscriptions after uninstallation/reinstallation of the application. So there is no stored application informations (e.g. shared preferences) to recover previous bought subscriptions. On a PurchaseUpdatesRequest() we only get the subscription parent and could not determine any end dates of the active subscription (e.g. 3 or 12 months), since they end dates are null if they are still active/valid. So we could no present the end date to the user (an warn abound out-bounding subscriptions) The application could only wait for the end date changed from null, which is really late, since the subscription is not valid anymore.
iap
10 |5000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

Samuel@Amazon avatar image
Samuel@Amazon answered
Hi, Sorry for delay in getting back to your question. If you uninstall and re-install your application, you can get all valid subscriptions by calling onPurchaseUpdateResponse api. All active and valid subscription would not have any end date because they will be auto-renewed after their subscription period. Only the subscriptions which are not valid and which user has opted to stop will have end date. Amazon will manage the periodic recurring charge for you; you do not need to do anything outside of initiating the purchase. If a subscription fails to renew - either due to an invalid payment instrument or if the customer opts out of the renewal - the Receipt data from the initiatePurchaseUpdatesRequest method call will contain a non-null endDate value indicating the date the subscription expired. Subscription information is returned in the Receipt object, via the getSubsriptionPeriod() method. SubsciptionPeriod.getStartDate() will always return the date the Subscription is purchased. SubscriptionPeriod.getEndDate() will return null if the Subscription is still active, or the date the Subscription ended if the period occurs in the past.
10 |5000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.