Version: 1.5
语言 : 中文
Account & Game Service
Push Service

IAP Service

The IAP Service provides a convenient in-app payment experience for apps. Through in-app payment, users can purchase various types of virtual goods in applications, including consumable goods, non-consumable goods, and subscription goods.

For more information, you can click the following link to reach directly:

IAP Service config

To integrate with IAP service:

  1. Open the OpenHarmonySDKKitsSettings window.

  2. Fill in the common configuration include client_id, app_id, Bundle Name.

  3. Check the IAP Kit.

  4. Add the information of products and choose correct product type which should be added in AppGallery.

  5. Click on Open Scene to open the demo scene with the interface integrated, and operate each function in the scene.

  6. If you want the application to integrate this service when it starts, please check Init On Start.

    Check the IAP Kit
    Check the IAP Kit

IAP Service demo scene

To open the IAP Service demo scene in the Tuanjie Editor: OpenHarmonySDKKits > OpenHarmonySDKKitsSettings > IAP Kit > Open Scene.

IAP Scene
IAP Scene

The IAP scene is divided into two parts: Common query and Purchase & Subscriptions process.

Common query

The functions of Common query and their calling interfaces are as follows:

Area Description
Verify Pay Env Click to Send a queryEnvironmentStatus request to IAP Kit to determine whether the service location of the user’s currently logged-in account is in a country/region that IAP Kit supports settlement.
Query Subscription Items Click to call queryProducts to obtain product information configured on AppGallery Connect and return a list of subscribed product information Products, including product price, name, description, etc.
Query Consumable Items Click to call queryProducts to obtain product information configured on AppGallery Connect and return a list of consumable product information Products, including product price, name, description, etc.
Query Unconsumable Items Click to call queryProducts to obtain product information configured on AppGallery Connect and return a list of unconsumable product information Products, including product price, name, description, etc.
Log Info The relevant log will be displayed here.

Purchase & Subscriptions process

Purchasing and subscribing are two complete processes that require calling a series of interfaces. It is recommended to click the buttons in order.

The functions ofPurchase & Subscriptions process and their calling interfaces are as follows:

Area Description
Create Purchase Click to display a window contains the consumable and non-consumable items that can be purchased. Then send a createPurchase request to pull up the IAP Kit cashier.
Create Subscription Click to display a window contains the subscription items that can be subscribe. Then send a createPurchase request to pull up the IAP Kit cashier.
Check Purchase/Subscription Info Click to call queryPurchases to view the results of this purchase.
Finish Purchase/Subscription Click to send FinishPurchase request to confirm shipment, notify the IAP server to update the product’s shipment status, and complete the purchase process.

Export and build

To run the demo on the OpenHarmony devices:

  1. Open the OpenHarmonySDKKitsSettings window.
  2. Make sure client_id, app_id and Bundle Name have been filled correctly. Make sure IAP Kit have been checked.
  3. Make sure the Product List has been filled correctly.
  4. Open the Build Settings window.
  5. Switch to OpenHarmony platform and check Export Project.
  6. Export project.
  7. Open the exported project in DevEco, build and run on OpenHarmony device.
Account & Game Service
Push Service