Testing of In-app Purchases in Huawei can be acheived by Sandbox environment and configuring test accounts in AppGallery Connect.

https://developer.huawei.com/consumer/en/doc/development/HMSCore-Guides/sandbox-testing-0000001050035039

How to prepare for Sandbox testing

Sanbox testing involves following procedure:

  1. Creating Test accounts

  • Sign in to AppGallery Connect and click Users and permissions

  • Go to Sandbox > Test accounts and click Add

  • Enter your test account information and click OK

Please note that a test account must be a registered HUAWEI ID. And the account takes 30mins to 1 hr to be added.

2. Set up a sandbox testing version

  • If the app package was never released in AppGallery Connect, its versionCode should be greater than 0

  • If the app package once released in AppGallery Connect, its versionCode of the package to be tested must be greater than that of the released one.

Testing Non-subscription Payments

Once you have initiated a request to purchase one-time product using a test account and installed the app to be tested, HUAWEI IAP detects that the user is a test user, skips the payment step, and displays a message saying that the payment is successful.

  • Sandbox testing purchase process is similar to the production environment

  • Incase the HMS Core (APK) version is earlier than 4.0.2.300, once a one-time purchase order is created in the sandbox environment, its payment has been completed. The purchase is successful even if you cancel the payment

  • Inorder to test a non-consumable product in the sandbox testing environment, you can purchase them, consume them, and then purchase another

  • When you checkout in the sandbox testing scenario, a dialog box with a sandbox icon is displayed. It appears on both the checkout screen and the successful purchase screen

Testing Subscription Renewal

The purchase process is similar to that of the one time purchase. The major difference between them are Subcription renewal have Subscription renewal result(success or failure) and Subscription period.

Test subscriptions renew much faster than actual subscriptions. For instance, for a actual subscription period of 1 week, the test subscription will renew every 3 minutes.

  • To test a subcription, you have to sign a contract and add a bank card. You will not be charged charged in test environment

  • During auto renewal proceess, no real time payment will happen. However, HUAWEI IAP directly returns a billing success

  • In the Sandbox testing environment, the subscription purchased will be renewed for 5 times and then it will be canceled. If required, the user have to manually resume the subscription. After this resume operation only one subscription period work, and no recurring will happen

  • When you checkout in the sandbox testing scenario, a dialog box with a sandbox icon is displayed. It appears on both the checkout screen and the successful purchase screen

Please note if you didnt receive Sandbox test screen during your purchase process, the transaction is not involved in the sandbox testing. If you continue the test, real payments will be made.

Did this answer your question?