In-app purchases are a cornerstone of mobile gaming. But adding them to Construct 3 isn’t always as straightforward as it might seem. We’ve compiled this guide for game developers using the Construct 3 in-app purchase feature. We’ll discuss the setup process, plugins, and accounts for both Google Play and C3.
This article assumes you are familiar with Construct 3, have created an account, and have at least a simple project created.
Non-Consumable (Durable) vs Consumable Purchases
Let’s take a minute to go over the basic types of in-app purchases available, durable and consumable. Non-consumable (a.k.a. durable) refers to an item with permanence in a game. These might be things like weapons, characters, skins, etc. They are typically purchased once and remain for the life of the user.
On the other hand, consumables are… meant to be consumed. These are usually one-time or limited-time use events. This could include power boosts, temporary invincibility, and player resurrection. Consumables can be purchased many times and stored in multiple quantities.
This is important because how items are recorded and queried varies significantly between these types.
The good news is that the app stores track durable goods. So you can query those stores directly by product ID to get that information for a given player. See Mobile IAP Events below on how to do this.
Consumable goods, on the other hand, require more work and are generally for advanced users. These purchases have a few different options available.
Consumable Storage and Tracking
The easiest and most straightforward way is to store consumables on a local device. This has the benefit of being easiest to implement. Developers can store this information on local storage and retrieve it on game startup or level load.
There are a few BIG issues with this approach. First, it was never designed to be secure! This is why you don’t see reputable companies placing sensitive data like credit card numbers there. Second, it won’t work for cross-platform games since they require different devices. Third, if lost, stolen, damaged, or upgraded, they will also lose that information. This is an issue for reinstalls as well.
However, it is great for quick testing and development. This is probably the only thing a developer should be using it for regarding IAP.
Cloud Storage (Servers)
Cloud storage makes things more complicated, but it may be necessary to provide a good user /experience. Several cloud services offer storage including Google Play and Playfab. They all have pros and cons including pricing or free tiers, storage size, and authentication.
Another possibility is setting up your own server. This has the benefit of allowing games to customize and provide the exact features they need. It also allows better prices since only commodity API and cloud services are needed.
However, there can be a significant development and ongoing cost involved with providing cloud services depending on your game’s complexity and needs. This includes development costs, security risks, and maintenance in the form of updates and bugs. Weigh the pros and cons carefully.
Mobile IAP Plugin
The in-app purchase plugin for Construct 3 has a new version that supports the latest version of Billing Library 5.
Note: You must have a paid version of the Construct 3 game engine to use the Mobile IAP Plugin.
From the Construct 3 editor, navigate to the Project window, and right-click on Object Types > Add new object type.
Select and add the Mobile IAP object type.
This will add the IAP plugin to your Object types and make it available to your entire project.
Export your Android Project
You may export your project as an Android aab file to submit to the Google Play console. From the Construct editor, click Menu > Project > Export. Choose Android.
Choose your export options. The minify simple mode with a lossless image format has been chosen in this example. Click next, wait for the export to finish, and download the file when it is complete.
Setting Up Google Play Console
Head over to https://play.google.com/apps/publish to set up a Google Play account. Select Yourself if it is for personal use or An Organization for Businesses.
Fill out the forms for the account type you chose and complete their registration. There is a $25 developer registration fee to be able to develop and sell in the Google Play store. Once you are finished, you can head back to the Google Play Console. You will also need to verify your identity before publishing your app. Click on Create app and create your first app.
Give your app a name, and language, choose between the App/Game selection, choose between the free/paid selection, and check the declaration policies. Next, hit the Create App button. You should see your app has been created. At this point, you are ready to get a merchant wallet.
At this point, we just want to add a product and call it a day. On the left navigation scroll down to the Monetize section and select Products > In-app products. Unfortunately, you will see something like this:
Click Upload a new APK. Alternatively, you can click on the Release > Testing > Closed Testing link as well. Then, click Manage track next to either the Alpha track or Create track if you want a new track.
On the next page Under the Releases tab, click Create new release.
For security, you must add app signing to publish on Android and associate your app with Construct 3. Click the Choose signing key, and then let Google generate a key on the following popup.
A new section for App Bundles will appear which will allow you to upload the .aab file we created in the previous steps.
Choose that file to submit it. Fill out a release name, and any notes you want and click Next. You may see several warnings and errors on the next screen. You must address those before publishing your app, but we can skip them for now.
Create an In-App Product
After all this, you can add your first product to your game. Under Monetize > Products > In-app products, click the Create product button
This will take you to the dedicated in-app product screen where you can add the product ID along with details and a price. This will be the same product ID you use for Construct 3’s Mobile IAP. You can only use lowercase letters, numbers, and underscores for this field.
Press save for now. You can also Activate a product from this page once you are ready to test it.
Mobile IAP Events and Actions
Now comes the payoff for all that work. But before purchases can be made from your game, you must register your products from C3.
Complete Product Registration
Calls to retrieve product ownership and purchase history both require this step for IAP to work correctly in your game.
First, call to Add product ID for every product you want to sell. This is an action in the Mobile IAP plugin that can be attached to an event. Each product should have a unique ID. For example, this could be performed during a level load or showing an in-game store.
Next, call Complete product registration when you are finished to end the registration process. You should receive a trigger for the On store registration success condition if you have it configured.
Mobile IAP Conditions
You can check on various IAP conditions throughout the product life cycle. Some common ones include Has Product, On purchase success, and On product available. You can find a complete list of them here https://www.construct.net/en/make-games/manuals/construct-3/plugin-reference/mobile-iap. Let’s add a condition to an event sheet.
Choose an event sheet that you want to use with IAP. Click Add event and then choose the MobileIAP plugin again. You will see this screen.
For this example, we’ll select the Has product event. Enter the product ID of the product to be checked. We’ll use the same product ID created in the In-App products step above for the Google Play console.
From here, a developer can easily connect other actions to this event such as equipping items, playing as characters, or displaying skins.
And with that, you now have the ability to add products and prices to Google Play, register those products from C3, and purchase and query for your game. It is quite a lot of setup, but these are necessary steps to get Android IAP working correctly.
Unfortunately, you will still need to repeat the process for the apple store and iOS. You may also need to support other platforms as well as design your in-game store and add more events and actions.
If you want a simple addon that does all this for you while offering dozens of different payment options, check out Zalance! Our IAP and subscription service was specifically designed to work with Construct 3.
Do you have to pay for Construct 3?
You do have to pay for Construct 3 if you want to use the Construct 3 Mobile IAP plugin. You can purchase a game engine license. Alternatively, the Zalance Addon for Construct 3 does not require a license and can be used on the free version.
Does Construct 3 require coding for IAP?
Construct 3 does not require coding for IAP, because it supports a no-code development style. If you use durable (non-consumable) IAP with the Mobile IAP plugin, then you can use events and actions. In addition, many URL requests can be performed with the Web Browser plugin if you send API requests to cloud services.
How Do I add IAP to iOS, web, PC, or macOS?
Repeating these steps for other platforms is tedious and costly. That is why we built Zalance to be cross-platform and support a variety of payment solutions. Take a look at how it can save you time and headaches on IAP, catalogs, and payments.
Title Image: Original by Rob Bulmahn