目录

Client Sample Code

Android Studio

This sample project provides examples of how to integrate IAP capabilities for consumables, non-consumables, and subscriptions.

Sample Code

Find It on Gitee

Find It on GitHub

Java sample code

Click here

Click here

Kotlin sample code

Click here

Click here

Before using the sample code, read the README file in the sample project carefully. Run the sample code only after you complete the following operations:

  1. Sign in to AppGallery Connect, download the agconnect-services.json file of your app, and copy the file to the app directory of the sample project.

  2. Open the build.gradle file in the sample project, and change the value of applicationId to your app package name.

  3. Change the value of PUBLIC_KEY in the CipherUtil class to the payment public key of your app.
  4. Replace the products in the sample project with your own products.
  5. Configure the app signature in the sample project.

For details, please refer to the README file in the sample project.

Eclipse

This sample project provides examples of how to integrate IAP capabilities for consumables, non-consumables, and subscriptions.

Sample Code

Download Package

Eclipse sample code

huawei-iap-client-eclipse-demo.zip