question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to detect subscription renewal?

See original GitHub issue

Is purchaseUpdatedListener called again, when a subscription is renewed? If not, what is the best way to detect this event, when not using server notifications?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:16 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
henrik-dcommented, Feb 1, 2021

@kayamy Yes, here is the basic function:

private async checkForSubscriptionUpdates() {
    // check if user was subscribed (information is stored in redux store)
    if (!this.isUserSubscribed()) return;

    if (Platform.OS === 'ios') {
      const receipt = await IAP.getReceiptIOS();
      await this.processReceipt(receipt);
    }
    if (Platform.OS === 'android') {
      const subscriptionPurchase = await this.getMostRecentSubscriptionPurchase(); // uses IAP.getAvailablePurchases()
      if (subscriptionPurchase) {
        await this.processReceipt(subscriptionPurchase.transactionReceipt);
      } else {
        await this.store.dispatch(user.actions.revokeProSubscription());
      }
    }
  }

processReceipt() sends the receipt to the server to check if the subscription is still active.

2reactions
lahiveecommented, Jan 9, 2021

If anyone is using Laravel, this seems to be the best package that handles all of the server notifications and receipt validation stuff: https://github.com/imdhemy/laravel-in-app-purchases

Read more comments on GitHub >

github_iconTop Results From Across the Web

checking if an auto-rewew subscription expired
1) If the app detect that the subscription has expired it adds a transaction observer and awaits a call to updatedTransactions with a...
Read more >
How to find your subscription renewal date - Shift Support
If you are an Advanced user or Team Admin, you can check your renewal date: Go to the online account portal and sign...
Read more >
How to Check Subscription Renewal Date - YouTube
This tutorial video is for teachers and administrators and shows you how to check your Ellii subscription renewal date.
Read more >
Testing Subscription Renewal Payments - WooCommerce
Visit your site's administration dashboard. Go to: WooCommerce > Status > Scheduled Actions. In the search box, enter subscription ID. Find the row...
Read more >
Android - How to check if subscription is renewed?
purchases().subscriptions().get( context.getPackageName(), subscriptionId, purchaseToken ).execute(); // Check the orderId or check the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found