In-App Purchase Blocks (with RevenueCat)
Last updated
Was this helpful?
Last updated
Was this helpful?
In-app purchases (IAP) refer to the ability to offer additional content or features within a mobile app for users to buy using real money. This provides a monetization strategy for app developers, allowing them to generate revenue from their apps. It's a way to offer users the option to enhance their app experience by purchasing extra items or features, such as digital goods, subscriptions, and premium content.
Publishing an app to the App Store and Google Play Store with in-app purchase blocks requires accounts with the following:
In-app purchases are supported on the Android and iOS platforms.
In-app purchases are not supported in web apps.
You cannot test in-app purchases with the Thunkable Live app.
If you don’t know which version of the blocks you’ve used, we can help! Look at the IAP blocks in your project and compare them to the images below.
Each of the old IAP blocks has dropdown options. If your app has these blocks, you’ll need to update them.
All of the new versions of the IAP blocks are purple and do not have dropdown options. If your app has these blocks, no block update is needed!
To migrate from the old in-app purchase blocks to the improved in-app purchase blocks:
Delete the old in-app purchase blocks.
Under the Advanced heading, click the gear icon associated with your existing IAP component.
You must follow the steps outlined below in the order they're listed.
This documentation assumes that you are publishing to both the Apple App Store and Google Play Store. If this isn't accurate, ignore the platform-specific instructions for the other platform.
Connecting your Thunkable and RevenueCat accounts requires copying and pasting API keys between the two accounts. We recommend having two tabs open concurrently, one signed in to RevenueCat and the other to Thunkable with your project open.
To connect your Thunkable and RevenueCat accounts:
Navigate to your RevenueCat tab.
Click Projects in the header.
Select your project from the dropdown.
Click API Keys in the sidebar menu.
Your project's public API keys are created automatically and appear under the heading Public app-specific API keys.
Click Show key associated with your iOS app.
Copy the provided iOS key.
Navigate to your Thunkable tab.
Click the gear icon in the sidebar to access the project's App Settings.
Return to your RevenueCat tab.
Click Show key associated with your Android app.
Copy the provided Android key.
Navigate to your Thunkable tab.
Paste the copied Android key into the Public Android SDK Key field.
To access the in-app purchase blocks:
Navigate to the Blocks tab.
Under the App Features heading, click In-App Purchase.
A drawer of in-app purchase blocks opens.
For more on publishing your app, please see these docs:
Products are what your app's users purchase. They are the individual SKUs (stock-keeping units) used to identify and track your inventory or stock. The stores (Apple and Google) process these SKUs and charge the user.
Your products must be configured for each store you intend to sell with. This is done within the respective stores.
Product configuration for Android devices is done in the Google Play Console, Google's central hub for managing app releases, testing, in-app purchases, and more.
To set up your in-app purchases in your Google Play Console:
Click Products under the Monetize heading in the sidebar.
Select In-app products or Subscriptions depending on what your app offers. We'll provide instructions for each below.
You must create a Google Play Payments profile if you haven't already done so. Follow the on-screen instructions.
Create in-app products or subscriptions.
To sell iOS products, you must sign Apple's most recent Paid Applications Agreement and fill out your bank and tax information. This is located at App Store Connect > Agreements, Tax, and Banking. This needs to be completed before you can test any purchases.
RevenueCat uses an Entitlements system to control access to premium features and Offerings to manage the set of products you offer customers.
Entitlements are the level of access that a customer is "entitled" to after purchasing a specific product. Offerings are a simple way to organize the in-app products you wish to "offer" and configure them remotely.
Offerings - only create one
Products - select either a subscription or a one-time purchase
Entitlements - not necessary, but you can create an entitlement if you wish
Metadata
Paywalls
To access the in-app purchase blocks:
Navigate to the Blocks tab.
Under the App Features heading, click In-App Purchase.
A drawer of in-app purchase blocks opens.
Drag and drop the required blocks into your workspace.
If they don't look like the blocks below, right-click on the block and select Show advanced block.
The "in app purchase offerings" block has two outputs: the standard error output and offerings.
The "offerings" output block returns information about the products users can purchase.
This information is primarily used to:
Display products on the screen
Make purchases with the "buy in app purchase package" block
The "buy in app purchase package" block has three outputs: the standard error output, purchase, and user cancelled.
Within the "offerings" output, the content you need is within “availablePackages”, an array that holds one or multiple packages. This is an example of multiple packages within “availablePackages”:
It can be viewed and understood in the simplified way below.
To purchase Package_1, you must get that package from the offering’s object using the “get property of object” block. Then, you can direct it with the string “availablePackages” followed by the index of the package we want purchased. In this case, we want Package_1, which has an index of 0 in an array. The final string will be “availablePackages.0”. For Package_2, it would be “availablePackages.1”.
The "in app purchase customer info" block has two outputs: the standard error output and customer info.
The "customer info" output block returns information on the items the user has purchased. This information can be used within the Thunkable app to check for and give the corresponding purchased item/feature.
The "restore in app purchases" block has two outputs: the standard error output and customer info.
The "customer info" output block returns information on the items the user has purchased. This information can be used within the Thunkable app to check for and give the corresponding purchased item/feature.
To test the IAP blocks you must publish your app to the Google Play Store or Apple App Store. You cannot test IAP with web preview or the Thunkable Live app.
Be mindful to leave extra time for testing in your app development cycle to allow time for each respective store to review your apps. Depending on your stage of app development, a review could take anywhere from an hour to four days.
TestFlight creates a sandbox environment automatically. When you send your update to the app store, you can test it without having it go to the live version.
You have to upload the APK or AAB file to the Play Store console before you can add any In-App Purchases.
There are two ways you can test how a pre-release app functions on the Google Play store: You can publish an app to the alpha or beta distribution channels. This makes the app available on the Google Play store, but only to the testers you put on a "whitelist."
In a few cases, you can test Google Play functionality with an unpublished app. For example, you can test an unpublished app's in-app billing support by using static responses, special reserved product IDs that always return a specific result (like "purchased" or "refunded").
At this time, there are no blocks to support in-app subscription management by the user.
Users can manage their own subscriptions in the Google Play Store or Apple App Store.
We recommend including instructions in your app or app’s website that outline the processes below.
Subscriptions on Google Play renew automatically unless you unsubscribe through the Google Play app. Uninstalling an app won't automatically cancel your subscription.
At the top right, tap the profile icon.
Select the subscription you want to cancel.
Tap Cancel subscription.
Follow the instructions.
Open the App Store app on your iOS device or on a computer
Sign in to the App Store if necessary
Choose a subscription, then do any of the following:
Change or cancel an existing subscription.
Resubscribe to an expired subscription.
If your app utilized the old in-app purchase (IAP) blocks, you’ll need to remove the keys from the old IAP component, remove the old blocks, replace them with the new IAP blocks, and create and configure an account with . These updates are needed before you publish an app with IAP functionality. If you currently have a published app with IAP capabilities, it will remain active. However, you cannot re-publish your app until the IAP blocks have been updated.
Click Delete.
Proceed with the below to implement new IAP blocks.
is a platform that is used to manage in-app subscriptions and purchases. It provides tools and services to handle subscription billing, manage user entitlements, and analyze revenue data. This platform simplifies implementing and managing in-app purchases and subscriptions, making it easier for you to monetize your apps effectively.
RevenueCat allows you to start for free with everything you need to build, maintain, and grow your subscription app. Once you surpass their defined earning threshold ($2,500 USD at the time of publishing), you will be required to pay. More information is available here: .
Create a . Additional instructions are available here: .
Configure your RevenueCat project and apps. Instructions are available here: .
Paste the copied iOS key into the Public IOS SDK Key field.
Drag and drop the "in app purchase offerings" block into your workspace.
Log into your account.
.
Follow these instructions to set up your in-app purchases in App Store Connect: .
In the block combination below, the "in app purchase offerings" block retrieves the "offerings" output. You can see the contents of this block's output here: .
On iOS, you must submit to the App Store via TestFlight to test the features. You can read more about TestFlight here: .
On Android, publish to the Play Store via internal beta testing. You can read more about internal beta testing in the Play Store here: .
Open the Google Play app .
Tap Payments & subscriptions Subscriptions.
Read more about managing your Android subscriptions .
Tap or your profile picture at the top right, then tap Subscriptions.
with other family members in your Family Sharing group.
Read more about managing your iOS subscriptions .