How to handle auto renewable subscriptions?
See original GitHub issueVersion of react-native-iap
4.4.9
Version of react-native
0.61.5
Platforms you faced the error (IOS or Android or both?)
iOS
Expected behavior
Actual behavior
Tested environment (Emulator? Real Device?)
Sandbox environment
Steps to reproduce the behavior
I have the below code snippet to handle subscription purchase
// On button press
requestPurchase(sku);
// Purchase updated listener
this.purchaseUpdateSubscription = purchaseUpdatedListener((purchase) => {
console.log('purchaseUpdatedListener', purchase);
const receipt = purchase.transactionReceipt;
await finishTransaction(purchase);
await Firebase.updateUser({
'subscription.ios': purchase
})
});
So far I was able to perform purchase and store the receipt onto Firebase. But my question is do I need to call getAvailablePurchases
on every app launch to store the latest purchase receipt? Or do I only need to store the receipt when the user purchases the subscription for the first time? Also, how do I validate if the subscription has expired?
Issue Analytics
- State:
- Created 3 years ago
- Comments:6
Top Results From Across the Web
Auto-renewable Subscriptions - App Store - Apple Developer
Auto -renewable subscriptions provide access to content, services, or premium features in your app on an ongoing basis. They automatically renew at the...
Read more >In-App Purchase Tutorial: Auto-Renewable Subscriptions
Auto -renewable subscriptions provide a way of offering your users continuous access to your app's renewing content – providing them with a ...
Read more >Guide to Auto-Renewable Subscriptions in Swift - AccuWeather
So let's dive into implementing auto-renewable subscriptions and make some money. Configure the Subscription Product. Step 1: Set up a ...
Read more >Swift tutorial: Auto-renewable subscriptions in iOS - Apphud
Let's talk about auto-renewable subscriptions on iOS. I will show how to create, manage, purchase and validate auto-renewable subscriptions.
Read more >Swift How to handle Auto-renewable Subscription receipt and ...
User can purchase either one month, one year auto renewable subscription or permanent permission · App should check if the subscription is still ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This is usually done using webhooks. For Apple you can enable server-to-server notifications that will communicate with your server. Google has something similar, but setting it up is much more complicated and there is no docs on that. Android Developers has a basic doc here, but what you want is a Pub/Sub system that google has.
Also this StackOverflow question has some good information
UPDATE I actually found a good source that will help you to set up server-to-server notifications. RevenueCat Docs has a lot of useful information. Here is the link for Apple and Google Pub/Sub
Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.