The Huawei in-app purchases help in accumulating or aggregating the multiple payment methods for a common global payment. This aggregation makes it easier to integrate into the application and thus increasing the revenue. The users of this can also purchase a variety of products or services including the common utility products and the virtual product subscriptions which are available directly within the application. There are three types of in-app products that are supported by HUAWEI IAP. These are-
- Consumable products which can only be used once and after that they are depleted. These have to be purchased again like the Extra lives and gems in a game.
- The second type is the Non-consumable products which have to be purchased only once as they do not expire. Examples of this include the extra game levels in any particular game or permanent membership of any application.
- The third type is auto-renewable subscriptions in which users can purchase access to the value-added functions or the content in a particular time period. These subscriptions are recurring and are automatically renewed until the user decides to cancel it on the whole. An example of this type of subscription is the non-permanent membership of an app which can be renewed every month.
The user needs to carry out some steps to complete the in-app purchases which are-
- Create and configure a piece of app information.
- After that enable the HUAWEI IAP.
- Then the user has to configure the product information in the AppGallery Connect.
- Then a project is to be created in the Android studio and integrated.
- Inform all the APIs of the HUAWEI IAP.
In this code lab and after following the procedure, the user can create a demo project and use the APIs to aid the process of purchasing in a game. The processes can be explored in the demo project to ease the work in the final project. Some of these processes are-
- Query regarding the details mentioned on the product.
- Initiating the process of purchasing and then completing the payment.
- Consuming the consumable which is one of the most important processes.
By creating these in-app purchases the user can create an app and configure the information. There are many prerequisites for completing this process. Out of these the hardware requirements are a desktop, a HUAWEI phone which can run the integrated app and a data cable to connect the phone to the desktop. The software requirements are Android Studio 3.0, the JAVA SDK 1.7. HMS core SDK 4.0.0300 and the HMS Core APK.
The configuration of a consumable of 10 gems helps the users to purchase, consume, and then purchase again according to their choices. To complete this process one has to follow the steps-
- Sign in to the App Gallery Connect account and click on My Apps.
- After that select the app for which the product is to be added.
- Surf through the Operate tab and go-to products and product management. Click on the product tab and add the product.
- The next step is to finish the configuration of the product and validate the put in information.