Video tutorial

Flutter In-App Subscription Tutorial (iOS and Android)

In this complete guide to setting up Flutter subscriptions, you’ll learn how to configure monthly and yearly subscriptions for a Flutter app.

Share this tutorial

If you prefer, we have this Flutter in-app purchases/subscriptions tutorial available as a written guide.

Flutter In-App Subscription Tutorial (iOS and Android)

[00:00:00] Hello. My name is Dave Faliskie. And today I’m going to show you how to set up in app subscriptions. for a Flutter app using RevenueCat.

[00:00:11] This tutorial is going to cover how to set up both monthly and yearly subscriptions for iOS and Android. And we are going to be using the Magic Weather sample app that RevenueCat provides. So the first thing we’re going to need to do is actually clone that repo locally, and then run the sample app. So you can find this repo on GitHub, and I’ll have links to everything below.

[00:00:30] There’s also a written version of this tutorial that you can check out. And all the links will be within that as well. So we’re going to clone this. If you copy this right here. Then you can open up your terminal and I’ll just do this on my desktop and we’re going to be running get clone and then paste in that repo there.

[00:00:51] You’ll see, I now have the purchase flutter folder here. If you open this up, it’s just the same exact stuff that’s in get hub. If you go to the revenue cat examples, you can see the [00:01:00] magic weather. App is right there. This is the whole sample app that we’re going to be actually using. Next we can open that up in our editor.

[00:01:06] I’m going to be using Android Studio, but you could also use VS Code. In Android Studio, we’re just going to open that file from the revenue cut examples there. All right. And now we can actually open the terminal down here and we can run a. Flutter pub get, and this will simply get us all the packages that this app contains.

[00:01:25] From here, we can run the app. I’m going to be using an iOS simulator for this, but everything we’re covering here will work for Android as well. Here’s an error that you might see pop up about the CocoaPods. And this happens quite often. Simply all you have to do is run pod repo update. So we’re going to go ahead and do that.

[00:01:44] And actually, I believe we need to do this in the iOS folder. Run it over in there, and then we can try running this again. Alright, great, so the app is running right now. You’ll see we have two tabs down here, the weather and the user. The user is really [00:02:00] not saying much, it just has an anonymous user ID here that you can read.

[00:02:04] And, you can see the subscription status is not active. Also, we have the change the weather button down here. If you click on this, You’ll see it just pops up with an error. That’s expected because we haven’t fully configured the app to work, so let’s go ahead and do that now. So the next thing we need to do is actually log into our RevenueCat account and create our project there.

[00:02:24] Over in RevenueCat, I have this new account here, which is completely blank. There’s nothing in it. So I’m going to go over to projects and create a new project. And I’m going to name this magic weather. Once we’re in the dashboard here, the first thing we want to do is actually create an entitlement entitlements and revenue cap, allow us to give a user access to specific features in our app.

[00:02:45] without needing to manage the actual product identifiers within our code base. So this is very valuable and one of the huge perks of RevenueCat because once we set this up on the entitlement basis, we can go into RevenueCat later and change our products out and link them [00:03:00] to that entitlement, but everything will still work as you would expect without having to redeploy.

[00:03:05] Your code base, creating the entitlement is simple. We can just click on the entitlements tab, and then we’re going to add a new entitlement. We’re going to call our entitlement premium because it’s going to give the user premium access to our app. And for the description, we’re simply going to put premium access to all app features.

[00:03:21] Now we can click add and we will have our entitlement here. So now we can go update our app to actually look for this entitlement. Back in Android studio, we’re going to go into the lib folder. SRC, and then find the constant. dart file. This is the file that we need to get fully updated so that our button down here will actually work.

[00:03:41] The first constant you can see is the entitlement ID, and it is already set to premium. So as long as you set your entitlement ID to premium, all lowercase, Then you actually don’t need to update this one, but if you made this identifier named anything else, you just want to make sure that you update that entitlement ID in the code as well.

[00:03:59] Next we [00:04:00] have the footer text, which you can go to the comment linked and read more about, but for now we’re just going to set that to a few sentences that say, By purchasing this, you’re agreeing to actually pay for it, and once the subscription ends, you’re not going to have access to it, but you can cancel it.

[00:04:14] Typically, when you have your privacy policy and your terms and conditions, you would link those in there as well. But for now, we’re just going to leave this as a simple paragraph. Next, we need the Apple API key, which we can generate within RevenueCat. So we’re going to go over to the apps and then click on the app store, name the app Magic Weather, And now we need to get the bundle identifier.

[00:04:35] This you can get from Xcode. So if you go back into Android Studio here, you can open your project in Xcode by right clicking iOS and then going to Flutter and open in Xcode. Once Xcode opens up, you’re going to click on the runner tab here and you’ll see your bundle identifier is right here. Now, if you’re following along, With the sample app as I am, you will need to make this something unique.

[00:04:59] So [00:05:00] I’ll add flutter to the end of it. But typically what you want to do is actually change this beginning part. And normally what this would look like would be calm and then it would be your name. So typically you would have not revenue cat here, but your name or your company name there. And then after that, you can pretty much have anything.

[00:05:19] If you’re using your own app, you probably already have a. Bundle identifier. That will work. Let’s copy this and we’ll paste that bundle identifier there. Now we need to get the App Store Connect specific shared secret. So this is assuming that your project is already set up in App Store Connect, which I do have mine set up right here.

[00:05:38] You can see it in Magic Weather Flutter. If you don’t yet have your project set up in App Store Connect, you can follow the link in the description to help you get that set up. What you’re going to do once you’re in here is go to the subscriptions And you should already have your subscription set up as well.

[00:05:54] I’ll talk about this a little bit more in a bit, but you’re going to go down to the app specific shared [00:06:00] secret and click manage. And you’ll see right here, the app specific shared secret, go ahead and copy that. And then you’re going to set the secret within revenue cut here and click save changes. So once you’ve done this, it’s actually going to generate an API key for you.

[00:06:14] So if you go to API keys, you’ll see you now have an Apple magic weather API key. And if you click show key, you could then copy that key. And this is what we need to put in our app. right here for the Apple API key. Now we can get our Google API key in a similar way. We’ll just go back to apps here and we’re going to add a new app and then click on play store.

[00:06:38] And then we’ll name this also magic weather. And now we need the Google play package, which you can also find within Android studio. If you go to Android apps and then the build dot Gradle file, you can find the package right down here in a similar way. We’re going to change this so that it is. Copy that over [00:07:00] and place that in here.

[00:07:01] You’ll then need to create the service account credential, Jason file, which if you follow this link, we’ll give you a bit more details on how to do that. That will happen in Google play console. So I already have an app. Also configured in here for this in Google Play Console. From within Google Play Console, you’ll want to be on the highest level here, and you’re going to go to Setup, and then API Access.

[00:07:24] So you might already have some of this set up, and you might not. Generally, you’re going to have to link a project. I already have a project linked, so I don’t need to do that. If you don’t already have a Google Cloud project linked, you will need to link a Google cloud project. Once you have that linked, once you scroll down, you’ll see your list of service accounts within your service accounts.

[00:07:42] You’re going to create a new one. So if you click this, learn how to create a service accounts is going to actually tell you, but you need to do this within Google cloud platform. From here, you’re going to click create service account, and now you’ll name your service account. So mine will be the magic weather revenue cap video.

[00:07:57] But you can name this anything you want. I would [00:08:00] recommend making this kind of specific. So that you can easily find it later. tHen you’ll get a service account ID, which is fine the way it is. And here you can add a bit of a description if you’d like. I’ll just make the description and the title the same.

[00:08:15] Then we’re going to create and continue. These roles are important. You want to select the pub sub admin, and then you also want to add another role. And this will be the monitoring viewer. So this one doesn’t need to be the admin. It’s just a monitoring viewer right here. monitoring viewer. So you want the PubSub admin and the monitoring viewer.

[00:08:34] Then you can click continue. And then from here, you’ll just click done. Right down here at the bottom of our list, you can see the new service count that we just generated, which is that magic weather revenue cap video. From here, you’re going to hit these three dots and then click manage keys. Now we need to add a new key.

[00:08:50] So we’re going to create a new key and this will be a JSON key. And then we can click create and downloaded that JSON file, which we’re going to upload to revenue cap. But there is one last step [00:09:00] that we need to complete here. And this is actually going to be back in the Google play console. So we can hit done on this, and then we’re going to refresh our.

[00:09:09] service accounts here. And then we’re going to find our new service account, which we just created, which is going to be right here. And then we’re going to click manage console permissions. And under the account permissions, there are three things you’re going to want to make sure are checked. First, that the view app information and download bulk reports.

[00:09:26] Read only is checked. And then under the financial data, you’re going to want to check both of these. And this is just going to allow RevenueCat to see some of the purchase data from within the app so that you can actually get some nice reports within RevenueCat. The rest of them you can just leave as they are.

[00:09:41] And then you can click invite user and then send the invite. What this basically does with this inviting of the user is it’s creating a user. That’s basically subscribe to these updates from your app. And then when we take that JSON file that we generated and put it in RevenueCat. It’s allowing RevenueCat access [00:10:00] through that new user that we created to see the information within your app, which will be information related to the subscriptions, information related to the downloads, information related to the financial data.

[00:10:12] But we have one last step in Google Play Console here because we didn’t actually connect our app to this new user that has this permission. So at the highest level of Google Play Console, we’re going to Go to users and permissions, and then we’re going to find that new user that we just created. And then we’re going to go into here and now we need to add our app.

[00:10:33] So under our app permissions, you see currently right now we have nothing. So we’re going to add our app and then select the magic weather flutter app. that we have and click apply. The defaults here are what we’re going to leave and then we’re going to click apply here. Finally we need to save these changes and then it’s going to prompt us, but we’ll hit yes.

[00:10:53] So now that user is actually linked to our Magic Weather Flutter app. So the last step here is to go back [00:11:00] into Revenue Cat and upload that file, which it should be in our downloads folder and then we’ll click save changes here. And at this point, we now have our Android app configured within RevenueCat.

[00:11:11] So we should have another API key. If you go to API keys, you’ll see we now have an Android one. So we could copy that key as well. And back in Android Studio, just like we did for the Apple key, we’ll update the Google key as well. And now we can save that. So now that we have all our constants set up, if we go ahead and click the change the weather button again, we get an error still, but it’s a different error this time.

[00:11:37] And what this error is saying is that there are no available products in Revenue Cat for us to display to the user. Now let’s go ahead and set up those products. This video is not going to cover in detail how to add products to app store, connect or Google play, but there are links in the description below, which will give you step by step instructions on how to do this.

[00:11:56] You can see an app store connect. If we go to the [00:12:00] subscriptions, we have our premium subscription group. If we click on that, we will have two different subscriptions. So we have the premium year and the premium month. And take note of this product ID here. This is what we’re going to be using within Revenue Cat.

[00:12:14] We’re also going to have a similar thing in our Google Play app. So if you scroll down towards the bottom and go to subscriptions, we have two that are in use. You can’t actually delete these. This one is Just one that needs to be deleted, but we have our premium year and our premium month so back in revenue cat We’re going to click on our products tab here And we’re going to add all four of those products two for Apple and two for iOS So if we click new the identifier here, we’ll do Apple first We have our RC premium year and make sure when you add this you’re adding it to the App Store And then secondly, we have our RC premium month.

[00:12:58] So we’ll add that one as [00:13:00] well. And next we can add our Google one. So these are actually called the same thing. So we have our RC premium year. This time we want to choose the play store and add it. And then lastly, we’ll get our RC premium month and also choose the play store there. Now that we have the four products in RevenueCat, we’re going to add them to our entitlement.

[00:13:25] So that entitlement is what we created earlier, and if we go into the entitlements and click that entitlement, we can associate products to it. So we will associate all four of these products. That looks good. So again, this entitlement is going to allow our app to communicate with RevenueCat and then find these specific products.

[00:13:47] But we’re never in our app going to hard code these product identifiers. We’re only going to have those configured in RevenueCat. So now our entitlement is configured with our products. And the next thing we’re going to do is create an offering. The [00:14:00] offering will be actually what is displayed to the user.

[00:14:02] When they hit that paywall and it will show them the products that are essentially offered to them at that point in time. So this is simple to do. We’re going to click on offerings and we’re going to create a new one, which will be called the default. And for the description, we’ll set it to the standard set of packages in the default offering.

[00:14:20] We are going to add those products. So we’re going to add the monthly products under the monthly identifier. And give it a description of unlimited access for a month and we’ll click add right there. And now within this package, we’re going to add our two monthly subscriptions. So we’re going to choose the RC premium month for the app store and the same RC premium month for the Google play store.

[00:14:45] So now this monthly package here has all the monthly available subscriptions. We’ll add one other one for the year lease. This will be the annual identifier and it’s going to be a similar description except it will be for [00:15:00] unlimited access for a year. And now under annual, we will also add two products, although they will be the year products and attach that.

[00:15:09] Alright, great. So now we have our default offering here, which is going to have both the monthly and the yearly packages within it. You can create multiple offerings, but you’re only ever going to be able to have one offering that is current or active at a time. So if you wanted to test around what products you’re offering to a user, For instance, if you didn’t want to always offer the yearly one, you can create another offering here and then just make that the current one.

[00:15:35] And that other offering could have just the monthly. subscriptions within it. But for now, we’re just going to keep it as the default and have both of the subscriptions. At this point, our code should already be set up to go ahead and pull this offering and display it to the user. So we’re going to rerun our app.

[00:15:53] And now if we click the change the weather button, You should see that you have the option to actually purchase [00:16:00] either the premium month or the premium year. So a few things to notice here. All the information within these cards, the premium month and the pricing, is all coming from AppStore Connect. So if you did want to change any of that, you would actually be changing it within AppStore Connect itself.

[00:16:14] This down here is the footer text that we configured. This is where you can put a link to your privacy policy or terms and conditions before we can actually make a purchase. We will need to create a sandbox user account within iOS. So if you go ahead and click, this is going to ask you to sign in when testing these in app purchases.

[00:16:29] It’s a great idea to actually use a physical device. So from here on out, we’re going to actually switch over to our physical device. So if you’re not familiar with setting up. a sandbox test user account, you’re going to go over to users and access and then go down to sandbox testers. And within here, you’ll be able to create an account.

[00:16:46] I already have one, you will need to use a real email address because it is going to send you a confirmation email to confirm that you’re a tester. The other thing to note is you can change the subscription renewal right here within Apple so that it. Read [00:17:00] news every five minutes or every three minutes.

[00:17:02] We’ll keep it at every five minutes and then whatever sandbox Apple ID you’re using, you’re going to want to log into your actual physical iPhone as a sandbox tester. So on the iPhone within settings, you’re going to go to the app store and then you’re going to scroll down and you can see there’s going to be a sandbox account here.

[00:17:23] This is where you can sign in as the user that you created your sandbox test account with. And now you can run the app again on your physical device. Alright, and once the app loads up on the physical device, you can choose to change the weather. And you’ll be prompted with the same screen. And now we can try the premium month.

[00:17:42] And since I am already logged in with that test user account, I can just go ahead and hit subscribe and then I’ll have to put my password in, which this password you would have set in the App Store Connect when you set up this user. So then go ahead and hit sign in there. The purchase will be [00:18:00] made successfully.

[00:18:01] And then once the purchase is successful, you’ll click that okay. And at this point, you should now be able to click the change the weather. And instead of seeing the paywall, you actually will have access to the premium feature. And in this test app, the premium feature is just that the weather will change to a random temperature and all that is looking good and happening correctly.

[00:18:24] So before testing on our Android device, let’s go ahead and complete the iOS. test by checking out the revenue cap dashboard. You’re going to be able to choose sandbox data, and if you click that, you should see we have one active subscription now, and our monthly recurring revenue is 10. So ignoring these purchases from 24 days ago, which was that I did on this test user account, you’re going to notice that the purchase we just made, which was made three minutes ago now and it expires in two minutes and that’s because we set our expiration for our subscription to be [00:19:00] five minutes.

[00:19:01] So even though this is a monthly subscription, it is going to expire in five minutes. We don’t have this fully configured yet to actually update RevenueCat from App Store Connect with these purchases. So if you wait the full five minutes, you’ll see that the purchase was five minutes ago, but we didn’t get an actual renewal.

[00:19:21] So to update that, you’re going to go back to the RevenueCat project and find the magic weather app for iOS. And then you’re going to see this Apple server notification URL and go ahead and copy that. And then back in app store connect, you’re going to go to the app information and you’ll see there’s this app store server notification.

[00:19:42] And under the sandbox server URL, you’re going to add that URL that you just copied and then click save. And what this is going to do is notify revenue cat of any server events that happen in app store connect. So every time a subscription is auto renewed, it’s going to notify RevenueCat. If [00:20:00] you go into the sandbox data now, you can see we do have these two subscriptions here.

[00:20:06] This one was the original, and then this was the auto renewal. In your original, it shouldn’t have a checkbox here, but since I have already tested this, it is coming up as a renewal for me. The important thing is that your auto renewals are working and you’re able to see that the auto renewal is being synced from App Store Connect to Revenue Cap.

[00:20:27] One thing to note, these tests Subscriptions are only going to auto renew, I believe 10 times. So if it has already renewed 10 times, it’s no longer going to auto renew. And if that’s the case, you can just simply go ahead and do another test subscription, and then it should actually update everything for you.

[00:20:45] So now we can go test on our Android device, but before we do that, we can actually set up the Google play console to give us those notifications so that when we actually do our test purchase, we’ll. Already have it set up so that it will auto renew for Android. It’s [00:21:00] pretty simple. If we go to our magic weather app for Android, there’s going to be a button here that says Google developer notifications, and we can just click connect to Google.

[00:21:11] The last step is to copy this Google Developer Notification Topic ID, and then go back into the Google Play Console, and find the monetization setup here, and then you’re going to paste that topic that you just copied right here, and then you can go ahead and hit Save Changes. In your app in Google Play Console, you need to make sure that your app is within a test track and that it has been approved.

[00:21:37] So if you go to Releases Overviews, you should be able to see your latest releases. And currently I have this in an internal testing, which is available to the internal testers. Which you need to also make sure that you have invited yourself to be an internal tester. If you’re not sure how to do any of this, there is links below and also links in the [00:22:00] written guide that will show you exactly how to set all this up.

[00:22:03] So at this point we can rerun our app from Android Studio on our physical device. And if we click the change the weather icon, we’ll be presented with the two options. And for this one we’ll try the yearly subscription. And we’ll go ahead and hit subscribe. And now if we click change the weather, you can see we do have access.

[00:22:24] And if we go back into revenue cat here. We should also see on the dashboard for our sandbox dashboard that we have one active subscription and it is that premium year, which we just did on our Android device. Now, this is going to expire in 32 minutes, but once this 32 minutes has elapsed, we should see that the subscription was auto renewed for this Android device as well.

[00:22:52] All right, great. So at this point, we have everything set up for our in app purchase subscriptions through Revenue Cat for both [00:23:00] iOS and Android, and everything is working great using our Magic Weather Flutter sample app. But I want to cover a couple core concepts that this app already had set up for us, so that if you are implementing this into your own app, which I’m sure you’re ultimately going to do.

[00:23:15] You will know exactly what you need to bring over from the sample app. So back in the sample app here, the first thing you will definitely need to do is. Store those constant values somewhere. So if you don’t already have a. File called constant or some way to store your constants. You’re going to want to create This is a file that you can just directly copy over and I would recommend keeping the names of these the same Next you’re going to want to create a class to tell your app which store to use so basically if you’re on iOS you want to be using the App Store and if you’re on Android you want to be using the Google Play Store.

[00:23:52] So this store config file you can pretty much just copy over. You’re not going to need the Amazon block if you’re not going to support Amazon. Now where [00:24:00] this is used is going to be in main. dart. So in your main. dart, file here, you’re going to want to have some sort of if else logic where you check to see if you’re on iOS.

[00:24:11] So that’s what this is doing right here. And if you are on iOS, then this is going to configure the store to use the app store and use that app store key. If you’re not on iOS, then it’s going to basically configure it for Android. This right here is also adding an extra layer to check if you are using.

[00:24:31] Amazon. And if you are using Amazon to use that instead of the Google play store, if you’re not going to support that at all, you could just remove those lines and just simply have the. Play Store similar to how we just have the app store. Next, you’re going to need some way to determine if your user is subscribed or not.

[00:24:49] Currently, if you click the button over here, you can see the user is not subscribed. So the app itself knows that the user is not subscribed or that there’s no active subscription. And depending on how your app is [00:25:00] set up, if you already have a user model, And you’re already tracking user information, you can store this information whether or not the user is subscribed right in your database.

[00:25:09] But if you want to do something a little bit simpler, and just store it right within your app, which is how this magic weather app does it. You’re going to need to create another class, and if you go into the models here, you can find the singleton data file, which will contain the app data. And this app data is basically just going to store.

[00:25:29] a few variables. So it’s going to, it’s going to check if the entitlement is active, which it defaults to false. If it is active, that means the user has access to the premium entitlement. And then it’ll also just have the app user ID. So it’s this entitlement is active that is going to be used basically to tell if the subscription is active or not.

[00:25:51] And now you can use this entitlement is active to either display the paywall or not. And if you haven’t built a paywall. You can look at the [00:26:00] paywall here and use this as a guide. There’s really three things that this paywall is doing that you would want to include in your paywall. The first one is that it requires an offering and that offering is really just the information that’s right here.

[00:26:13] So in this example, the offering is the premium features. And it has those two premium products. And this class is part of the Purchases Flutter package, which is the RevenueCat Flutter package, which obviously you would also need to install if you were doing this within your own project. So yes, the first thing is that an offering is required.

[00:26:35] So whenever you create an instance of this paywall, you have to pass an offering to it. The second thing is that you’re going to have some sort of list builder. So right here, you can see there’s a list of two products that are offered. And if we find our list builder here. You’re going to see that the list builder is looking at the offering itself, and it’s finding the available packages within the offering, and [00:27:00] basically it’s going to build a tile for each one of those packages.

[00:27:05] And you can just see that the products list is basically the same thing, it’s just the available packages. So you will want to display all of the available packages within the offering. On your paywall there. And the last thing is that you want to make sure you’re including that footer text. The footer text is right here and it’s just displaying at the bottom.

[00:27:24] So that is the simple paywall there. So you have your paywall now and you know how to configure your app. Last thing that you would do is actually display the paywall conditionally, depending on if that user has a subscription or not. And in this app, it’s happening in this weather. dart. So that’s basically this screen.

[00:27:42] The important thing is this button here. So you can find where this button is, the change the weather button. And you can see it’s down towards the bottom here. What the on press is doing here is calling this perform magic function. So if we go and find that, which is higher up in this file, you can see it’s just setting a loading state.

[00:27:59] And what [00:28:00] it’s doing here is it’s getting the customer information. And this customer info is going to be looking at. RevenueCat, and looking at the customer that is logged into the app currently, RevenueCat’s automatically going to add customer IDs. It’s going to see if the customer that’s using the app right here, if they have the entitlement.

[00:28:19] Of that entitlement ID and again, this entitlement ID would be what we configured back in the constant of this entitlement ID. So it’s in this case checking for premium and it’s going to see if that entitlement ID is not null. So that means the user is entitled to this feature and then it’s also going to check that it’s active.

[00:28:40] So that active is equal to true. If that’s the case, it’s going to give the premium feature. So this right here is actually the premium feature. And it’s what you saw before where the weather is changing. That’s what this function right here is doing. If not, so if the user does not have that entitlement.

[00:28:56] Then we’re going to get the offers. [00:29:00] So we’re going to make a call to Revenue Cat and get all of our offers that we have configured. And you can see that’s happening right here within this try block. It’s getting the offers. And this is just catching the exception if that doesn’t work. But once we have the offers here, we’re going to make sure that our variable actually has some data.

[00:29:18] And as long as it has data, we’ll drop down to this else block here. And we’re going to show that modal bottom sheet, which is exactly what happens right here, is that modal bottom sheet. And you can see that this is actually just going to be returning that paywall. So that paywall was that class that we just discussed.

[00:29:35] And you can see it is passing an offering. And notice that the offerings passing here is that current offering. Because as we said before, in Revenue Cat, you can have multiple different offerings. And the current one is typically the one that you’re going to want to be using and passing within your code.

[00:29:50] So yeah, that current offering gets passed in and then that populates the paywall itself right here. And that is essentially it. That’s how you would create your own paywall and how you can [00:30:00] use this code and modify it within your own app. One last thing to note is when setting up in app purchases, you do need to configure a restore purchase button.

[00:30:10] This is extremely simple with revenue cat. If you look under our user where this is actually already set up, you can see it’s just a button. So there is a button. Down here called Restore Purchases, and the only thing it has is an onPressed, which calls Manage User Restore. This is, this Manage User is just a way to basically make all these buttons one function.

[00:30:36] So if you go up here, you can look at what the Manage User is actually doing, and it takes in a task and a new app user ID. So the task for this is going to be. Restore, and all that it’s going to do is await the purchases restore purchase. If you did it like this, then you have to make the button itself asynchronous.

[00:30:57] That’s why the manage user is a nice way to extract that out. [00:31:00] But it’s really just this one line is what you would be calling is the purchase restore purchase. And then that will restore the user’s purchases. Hopefully you found this example useful. Also, you can check out the RevenueCat documentation, which is a great resource and has a ton of great information on how to set up everything.

[00:31:19] Alright, hopefully you’ve enjoyed this video. Bye for now.

Subscribe to newsletters

Watch more

Video tutorial

How to use RevenueCat Targeting

Developer Advocate, Charlie, walks you through how to use RevenueCat Targeting to customize your Offerings for different audiences.

Video tutorial

How to use RevenueCat Paywalls

Charlie walks through how to build a paywall using RevenueCat's brand new Paywalls feature.

Video tutorial

Using RevenueCat’s New Rest API | Product Setup

We're launching a brand new API, with improved developer usage in mind. Create, retrieve, and manage products, offerings, and entitlements with the endpoints discussed in this video.

Want to see how RevenueCat can help?

RevenueCat enables us to have one single source of truth for subscriptions and revenue data.

Olivier Lemarié, PhotoroomOlivier Lemarié, Photoroom
Read Case Study