HUAWEI In-App Purchases (IAP) enables you to sell a variety of virtual products, including consumables, non-consumables, and subscriptions, directly within your app. To support in-app payment, all you need to do is integrate the IAP SDK and then call its API to launch the IAP checkout screen. Below are some frequently asked questions about IAP and their answers. Hope they are helpful to you.
Q: A monthly subscription doesn't reach the end of a subscription period, and is changed to a yearly subscription in the same subscription group. After I visit the Manage subscriptions screen in Account center and cancel that monthly subscription, the yearly subscription is also canceled. Why is this?A: The yearly subscription doesn't take effect until the end of the subscription period during which the subscription change operation is made. So after you cancel the monthly subscription, the yearly subscription that hasn't taken effect will also disappear. Your app will receive a notification about the cancelation of the monthly subscription. As the yearly subscription hasn't taken effect, no relevant cancelation notification will be received.
Q: My app tries to bring up the IAP checkout screen on a Huawei smartwatch, but only receives a message telling me that some HMS Core services need to be updated. After I update it, the update fails (error code: 102).A: This error code generally means some kit updates are needed, but no relevant packages are found from HUAWEI AppGallery for smartwatches. If your app running on the smartwatch has integrated the IAP SDK for HarmonyOS (JavaScript), two services need to be updated: JSB Kit and IAP Kit. JSB Kit has already been launched on HUAWEI AppGallery for smartwatches, but IAP Kit still needs some time.
Here's a workaround for you. Make your app request that users download the latest HMS Core (APK) from HUAWEI AppGallery for smartwatches. (See error code 700111, API call error resulting in the update failure.)
Q: IAP has two SDKs: one for Android and the other for HarmonyOS. Are there any differences in the functions and devices supported by the two SDKs?Both SDKs provide basic IAP services, including managing orders, making subscriptions, and viewing purchase history, but the SDK for HarmonyOS temporarily does not support non-PMS payment or pending purchase. (PMS stands for Product Management System) In terms of supported devices, the SDK for HarmonyOS supports Huawei phones, smartwatches, and tablets, and the SDK for Android supports not only the devices mentioned above but also non-Huawei phones and head units.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Q: I find that the obtainOwnedPurchasesRecord API in IAP SDK 4.0 or later fails to query non-consumables managed in the PMS and purchased through the productPay API in IAP SDK 2.x. Why?A: Data of IAP SDK 4.0 or later and that of IAP SDK 2.x is stored in different databases and temporarily cannot be migrated to the same one, so the problem you've found arises.
Here's a workaround for you. If needed, make your app show only the data generated after IAP SDK 4.0 or later is integrated. For example, if you have integrated IAP SDK 4.0 or later on January 1, 2022, tell users that the starting day of their data query can only be January 1, 2022 or later.
A better way is that you can merge data of IAP SDK 2.x (obtained from the app server) with that of IAP SDK 4.0 or later (obtained through the IAP SDK API) depending on your situation, such as using the same data type for them and placing them on the same server.
Q: During sandbox testing on a Huawei smartwatch, the QR code for payment does not appear after the IAP checkout screen is displayed, and an error indicating incorrect request parameters is reported. What should I do?A: Payment through QR code scanning such as on a smartwatch or smart display, is temporarily unsupported in the sandbox environment.
If you do need to test the mentioned payment method, sign in with a non-sandbox account (or if you have only one account, remove it from the sandbox environment) and test the relevant functions in the production environment.
For more information about HUAWEI IAP, please visit the HUAWEI Developers website. Or you can directly click here to find more IAP FAQs.
Related
AppsUP contest has already been launched for one month. A number of participants in the forum ask some questions about Ads Kit. Today I want to share the frequently asked questions of Ads Kit with you. Hope they can be helpful for you.
Q: How to integrate Huawei Ads in my game? How could it compliant to EU consent?
A: Here is the link: https://developers.google.com/admob/android/eu-consent
Q: How to get ads ids for my apps those are available on Huawei Developer Console?
A: regarding getting Ads ID, please first make sure your developer account is a Company Account, because Ads on individual account is not available just yet.
If your account is a company account, you can login to your console
https://developer.huawei.com/consumer/en/console#/serviceCards/
Then look for the Monetize Service section and click on Publisher Service. There you can select My Apps, click Add app, and then you can register your app for Ads Service. Afterwards an Ads ID will be generated for you and will be showed on the panel.
Q: I used cordova for development app and plugins that provided from huawei like analytics and I succeeded, but for ads-kit can’t find guide for integration plugin - only I can find download plugin 4.0.4 and demo example. But what I get Console without any fired event that registered like "failed" and also did not get any Oaid.
A: Some kits are incompatible with non-huawei devices, even if you install the HMS core APK. You can check the compatibility for each kit here.
Q: I find all the sample use the test ads id but how to make the release one?
A: Individual account is not supported yet, but this function will be available at end of August, confirmed by related department.
Q: Why do native ad videos fail to be played and remain in loading state?
A: On mobile phones whose targetSdkVersion is 28 or later, ad video assets may fail to be downloaded. In this case, you need to configure the app to allow HTTP network requests. For details, please refer to Configuring Network Permissions.
Q: What are the differences between the ads-lite SDK, ads-identifier SDK, and ads-install referrer SDK provided by HUAWEI Ads Kit?
A: The Difference:
1. ads-lite: Integrates ad formats such as banner, native, rewarded, interstitial and splash ads.
2. ads-identifier: Obtains the OAID and the value of Disable Ads Personalization.
3. ads-installreferrer: used to obtain an install referrer.
To know more please refer to Integrating the HUAWEI Ads SDK.
Q: How is an ad report generated? Is developer data reported in two copies (one copy for Huawei and the other copy for the third-party platform)?
A: An ad report is generated after the server cleans various ad SDK-reported ad events for the anti-cheating purpose. The ad SDK in the app reports data to the ad platform and third-party advertising platform.
Q: I am individual developer. What platform I can use to monetize my apps?
A: You can apply for the Merchant Service if you want to use the In-App Purchases service, distribute paid apps or themes, or carry out joint operations (for apps, games, and themes) with Huawei. Please follow the instructions here:
https://developer.huawei.com/consumer/en/doc/start/10112#h1-1588057611069
Q: I want to distribute my Games in China. When I select china it asks me to upload some Copyrighted approved content? How can I bring these documents to china government because I am not from China but I want to distribute my games in China as well on App Gallery.
A: a. Publish a game in China, the law has requirements for both companies and games.
For companies: should have ICP, Network culture business license and Internet publishing license
For games: should have Software copyright, Game operation record and ISBN
b. Oversea game companies cannot apply for the certificates, so only have two ways to launch game in China:
Register company in China with 100% domestic capital Agent cooperation, and find a Chinese publisher release in China
Q: Why do banner ads fail to be obtained after my app has integrated the HUAWEI Ads SDK? The displayed error code is 1.
A: If the value of errorCode is 1, check whether AdId and BannerAdSize are correctly set in BannerView. The following table describes the error codes.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
If you also have other questions about this kit. Leave your reply below.
About HUAWEI Account KitHUAWEI ID is the credential that provides users with access to a wide range of Huawei services, such as Huawei cloud services. As a fundamental development service offered by HMS Core, Account Kit provides you with simple, secure and quick sign-in and authorization functions. Rather than needing to repeatedly enter account and password information, and then wait for authentication, users can simply tap the Sign in with HUAWEI ID button to sign in directly to your app via their HUAWEI IDs.
AdvantagesAuthorized Sign-in for All ScenariosAccount Kit enables the user to be authorized to sign in to your app through a HUAWEI ID, sparing them from having to enter personal information, setting passwords, and waiting to have the information verified by email or SMS message. Once authorization has been completed, no sign-in authorization screen will be displayed when the user signs in to your app again, greatly reducing the user churn rate during registration and sign-in.
In addition, Account Kit supports seamless sign-in switching between different devices, including mobile phones, tablets, Vision, head units, and watches. This helps you better present your product and services on Huawei devices across all scenarios.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
A Global HUAWEI ID User BaseAccount Kit enjoys a truly global reach, serving more than 190 countries and regions, and coming supported in 70+ languages. By integrating the service into your app, you'll benefit from access to a vast number of new potential users, and be equipped to expand your presence in new markets.
Secure and Reliable ServicesAccount Kit complies with prestigious international protocols, including OAuth 2.0 and OpenID Connect, and enables users to complete sign-in via a password and verification code, with the data encrypted, as well as offers an RISC-based cross-account protection function. This rigorous framework helps ensure that Account Kit meets relevant user privacy regulations around the world, and when coupled with HUAWEI ID sign-in, frees you from the hassle of managing user account data.
HUAWEI ID has obtained the EuroPriSe certification.
A Convenient and Cohesive SolutionThe development guide, sample code, and integration tool for Account Kit are continually being optimized to reduce integration costs.
Quick integration on the client: You can use HMS Toolkit to download the demo, check development environment configuration, and drag and drop the required code to complete integration in half a working day.
Quick integration on the server: You can reference both the Java and PHP sample code.
Account Kit allows you to connect to the Huawei ecosystem using your HUAWEI ID from a range of different devices, including mobile phones, tablets, and Vision.
Account Kit offers simple, secure and quick sign-in and authorization functions. In addition, it leverages the reach of its vast user base and all-scenario ecosystem, to provide you with direct access to new users in new markets.
We will continue to optimize Account Kit to help you achieve your business goals, and hope you'll enjoy access to such a broad range of game-changing services.
Use a browser to scan the QR code below to try the demo app:
(Note: The app may collect relevant information for user statistics.)
For more information about Account Kit, please visit:
Development guide
Codelab
Video course
For more details, you can go to:
l Our official website
l Our Development Documentation page, to find the documents you need
l Reddit to join our developer discussion
l GitHub to download demos and sample codes
l Stack Overflow to solve any integration problems
About HUAWEI Account Kit
HUAWEI ID is the credential that provides users with access to a wide range of Huawei services, such as Huawei cloud services. As a fundamental development service offered by HMS Core, Account Kit provides you with simple, secure and quick sign-in and authorization functions. Rather than needing to repeatedly enter account and password information, and then wait for authentication, users can simply tap the Sign in with HUAWEI ID button to sign in directly to your app via their HUAWEI IDs.
Advantages
Authorized Sign-in for All Scenarios
Account Kit enables the user to be authorized to sign in to your app through a HUAWEI ID, sparing them from having to enter personal information, setting passwords, and waiting to have the information verified by email or SMS message. Once authorization has been completed, no sign-in authorization screen will be displayed when the user signs in to your app again, greatly reducing the user churn rate during registration and sign-in.
In addition, Account Kit supports seamless sign-in switching between different devices, including mobile phones, tablets, Vision, head units, and watches. This helps you better present your product and services on Huawei devices across all scenarios.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
A Global HUAWEI ID User Base
Account Kit enjoys a truly global reach, serving more than 190 countries and regions, and coming supported in 70+ languages. By integrating the service into your app, you'll benefit from access to a vast number of new potential users, and be equipped to expand your presence in new markets.
Secure and Reliable Services
Account Kit complies with prestigious international protocols, including OAuth 2.0 and OpenID Connect, and enables users to complete sign-in via a password and verification code, with the data encrypted, as well as offers an RISC-based cross-account protection function. This rigorous framework helps ensure that Account Kit meets relevant user privacy regulations around the world, and when coupled with HUAWEI ID sign-in, frees you from the hassle of managing user account data.
HUAWEI ID has obtained the EuroPriSe certification.
A Convenient and Cohesive Solution
1. The development guide, sample code, and integration tool for Account Kit are continually being optimized to reduce integration costs.
ü Quick integration on the client: You can use HMS Toolkit to download the demo, check development environment configuration, and drag and drop the required code to complete integration in half a working day.
ü Quick integration on the server: You can reference both the Java and PHP sample code.
2. Account Kit allows you to connect to the Huawei ecosystem using your HUAWEI ID from a range of different devices, including mobile phones, tablets, and Vision.
Account Kit offers simple, secure and quick sign-in and authorization functions. In addition, it leverages the reach of its vast user base and all-scenario ecosystem, to provide you with direct access to new users in new markets.
We will continue to optimize Account Kit to help you achieve your business goals, and hope you'll enjoy access to such a broad range of game-changing services.
Use a browser to scan the QR code below to try the demo app:
(Note: The app may collect relevant information for user statistics.)
(Note: The app may collect relevant information for user statistics.)
For more information about Account Kit, please visit:
l Development guide
l Codelab
l Video course
For more details, you can go to:
l Our official website
l For GitHub to download demos and sample codes
| Original Source
We recently received a question from a developer outside the Chinese mainland regarding onRewardAdFailedToLoad error 3 that keeps returning when the developer is testing their app's integration with HUAWEI Ads Kit. The developer used a Samsung Galaxy S7, which has HMS Core (APK) 5.0.2.301 installed. This error indicates that no ad is returned during the testing phase. On top of this, they also discovered check hms sdk available error in the logcat logs.
For details about this specific issue, please refer to https://stackoverflow.com/questions/65723806/huawei-ads-check-hms-sdk-available-error.
A solution for this problem is as follows:
First, onRewardAdFailedToLoad error 3 and the returned error code (204) in the developer's logs indicate that an ad request was successfully sent, but the server did not return an ad. According to the developer, a Samsung Galaxy S7 was used for testing. Unfortunately, for HUAWEI Ads Kit, only Huawei devices can currently be used for testing, and for this reason it is advised that the developer uses a Huawei device.
Supported Huawei devices are listed in the figure below. We are committed to optimizing our services to support HUAWEI Ads Kit integration on non-Huawei devices in the near future.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Some of you may ask: Are there any other solutions if no Huawei device is available for testing?
Of course yes. Huawei's Cloud Debugging allows you to test your app on wide range of popular Huawei devices. For details about this, please refer to https://stackoverflow.com/a/63877454/13329100.
Along with error 3, error 499 also frequently occurs if no ad is returned. If this error code is returned, check whether the test device meets the following requirements:
1. The device is a Huawei mobile phone sold outside the Chinese mainland.
2. The device is connected to networks outside the Chinese mainland, excluding the United States.
3. The area in system settings is outside the Chinese mainland.
4. The device time is the current time.
5. The device has the latest version of HMS Core (APK) installed.
6. The device is inserted with a SIM card registered outside the Chinese mainland.
For details about other error codes that are frequently returned during integration with Ads Kit, please refer to Error Codes.
Now that we've proposed solutions for some common error codes that developers may encounter when integrating their apps with the HUAWEI Ads Kit, let's take a look at what HUAWEI Ads Kit is and the capabilities that this kit provides.
Introduction to HUAWEI Ads KitCurrently, HUAWEI Ads Kit mainly provides two capabilities: Publisher Service and Identifier Service.
Publisher Service
HUAWEI Ads Publisher Service is a monetization service that leverages Huawei's extensive data capabilities to display targeted, high-quality ad content in your apps to a large audience of Huawei device users.
We offer a range of ad formats so you can choose whichever suits your app best, including banner, native, rewarded, interstitial, splash, and roll ads. You can use the HUAWEI Ads SDK to integrate these ads into your app to bring in revenue using our high-quality advertising services.
We also offer the Publisher Service Reporting API for you to obtain traffic monetization report data, including the number of ad requests, number of returned ads, click-through rate, and impression rate.
Identifier Service
Ads Kit provides the Open Advertising Identifier (OAID) and install referrer capabilities for advertisers to deliver personalized ads and attribute conversions.
An OAID is a non-permanent device identifier. You can use them to provide personalized ads for users while protecting their privacy. In addition, third-party tracking platforms can provide conversion attributions for advertisers based on OAIDs.
You and advertisers can obtain app install referrers through APIs provided by Huawei. Advertisers can use install referrers to attribute conversions to different promotion channels.
Stack Overflow and HMS CoreAs the world's largest technical discussion platform, Stack Overflow is an open platform for developers around the world to raise programming-related questions. You are welcome to post your questions about HMS Core integration in Huawei's own section (https://stackoverflow.com/questions/tagged/huawei-mobile-services) on Stack Overflow.
For more details, please refer to the following links:
HUAWEI Ads Kit official website: https://developer.huawei.com/consumer/en/hms/huawei-adskit?ha_source=hms1
Integration guide to HUAWEI Ads Publisher Service: https://developer.huawei.com/consumer/en/doc/development/HMSCore-Guides/publisher-service-dev-process-0000001050064964
Integration guide to HUAWEI Ads Identifier Service: https://developer.huawei.com/consum...e-dev-process-0000001050064984?ha_source=hms1
Ads Kit client sample code: https://developer.huawei.com/consum...ample-code-0000001050066947-V5?ha_source=hms1
Ads Kit server sample code: https://developer.huawei.com/consumer/en/doc/development/HMSCore-Examples-V5/server-sample-code-0000001056563536-V5
To learn more, please visit:
HUAWEI Developers official website
Development Guide
Reddit to join developer discussions
GitHub or Gitee to download the demo and sample code
Stack Overflow to solve integration problems
Follow our official account for the latest HMS Core-related news and updates.
Original Source
How can i get AdsID?
HUAWEI In-App Purchases (IAP) implements convenient in-app purchasing via either the service's SDK or its server.
Features and integration details of IAP are well illustrated in its official documents. I've used the service extensively for my apps and kept track of its issues (both from myself and other developers). Following on from my previous article that looked at the sandbox testing issue, this article will present FAQs related to other IAP aspects.
Question 1: The callback request of IAP is empty, containing no valid user information. Why?
Question details:
I integrated my app with HMS Core SDK 6.4.0.301 and IAP SDK 4.0. Users paid for a yearly subscription in the app, but the backend of my app didn't automatically deliver the subscription to users. I went to the order report in AppGallery Connect to redeliver the subscription to users, but the callback result was invalid.
To troubleshoot this issue, I used the test API. In the printed callback request of IAP, I discovered that the request body was an empty string that contained no valid user information. So I checked the official IAP document, which says that an app using IAP SDK 4.0 will not receive the payment success callback, so I'm not sure whether it is normal that my app received an empty callback.
Also, the subscription callback API of the IAP server would return 200 even upon an exception. The reason, I assume, was that the IAP server believed that my app had delivered the subscription to users. In this case, can product redelivery be triggered after the app is restarted?
Answer:
The official FAQs section for IAP illustrates what will happen after the redelivery button in the AppGallery Connect order report is clicked.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Normally, there will be no callback upon payment success. However, a callback containing an empty request body is actually not an issue, which can be ignored.
The redelivery process of the IAP SDK applies only to consumables, which needs to be triggered in the app integrated with the SDK in some specified scenarios, such as app startup. When an exception occurs during the process, an error code (like -1, 60051, or 1) will be returned, which you need to deal with according to the error description. More details can be found here.
As for subscriptions, notifications of key events are used. Click here for more details.
In no scenario would the IAP server send 200 upon an exception to your app server because the IAP server believes that your app has delivered the subscription to users. If you are not sure why your app server receives 200, you can submit a ticket online with the order number corresponding to the subscription in question for the technical support of IAP to look into.
Question 2: I submitted settlement sheets in September 2022, and the sheets have been stuck in the In payment state since then. However, the corresponding earnings have not been sent to my bank account. Why?
Answer:
The official Settlement document says that after a settlement sheet is submitted, the sheet will enter the In payment state. To receive the earnings, you may need to issue an invoice, according to where your app is released.
Specifically speaking, you are not required to issue an invoice if your products are distributed in countries or regions outside the Chinese mainland, and you have signed an online agreement with Huawei. According to Exhibit C of the HUAWEI Developers Merchant Service Agreement, Huawei will perform self-billing. To view and download invoices issued by Huawei, sign in to the console of HUAWEI Developers and go to My accounts > Credited. Find your settlement sheet and click Invoice.
If your app is released in the Chinese mainland, issue an invoice according to the official instructions.
Multiple settlements can be combined for invoicing in a single application. Such settlement sheets must have the same contract, service type, currency, signing entity, and prepayment term. It's also worth noting that the invoice amount must be the same as the amount sum of the combined settlement sheets.
For details about how to perform invoicing and other settlement-related instructions, go to the Self-service Settlement Guide.
Question 3: The official IAP document noted that it would gradually end support for the old domain names of AppGallery sites, TLS of earlier versions, and cipher suites. Are there any detailed instructions on how to replace the old domain names, TLS versions, or cipher suites with new ones?
Question details:
To ensure higher security and reliability for apps, IAP has changed its support for the domain names of AppGallery sites, TLS versions, and cipher suites. Specifically speaking, from April 2023, IAP will no longer support TLS earlier than 1.2 version or cipher suites that are not specified. The support for old domain names of AppGallery sites will be canceled in the near future.
Answer:
There is no guide document illustrating how to replace the old TLS versions or cipher suites, but the official IAP demo can serve as a reference.
The sample code of the API for verifying the purchase token of the order service is used as an example here, to show how to replace the old domain name. For example, for an app released to AppGallery in the China site, replace
https://orders-at-dre.iap.dbankcloud.com
with
https://orders-drcn.iap.cloud.huawei.com.cn
, which is the domain name of this site.
Click here for more information.
Question 4: I noticed that there is an expirationDate field in the subscription purchase data of users, which is returned by IAP. Is the time indicated by this field the same as the time when IAP bills the user account for renewing a subscription near the end of the current billing cycle?
Question details:
A user purchased a yearly subscription on December 5, 2021, and IAP returned the expirationDate string, which is a timestamp. On December 4, 2022, IAP automatically billed the user account for subscription renewal. However, the time indicated by the timestamp is December 8, 2022. My question is: Will IAP bill a user in advance for subscription renewal? If not, does this mean that the expirationDate time is not the same as the time of billing for subscription renewal? Which field should I refer to if I need to know the billing time for subscription renewal?
Answer:
In short, the time indicated by the expirationDate field is not the same as the billing time for subscription renewal.
Below is the official description of the expirationDate field in the InAppPurchaseData class.
In other words, this field indicates the time when a subscription expires.
According to the billing rule of IAP for a subscription, IAP tries to bill a user 24 hours before a subscription renewal. Therefore, it is normal that IAP billed the user account on December 4, 2022, which is within 24 hours before the current billing cycle ended (December 5, 2022). If billing fails, IAP will repeatedly attempt to bill the user within a specific duration. Once the maximum number of failed attempts has been reached, IAP will cease billing.
On top of this, the IAP server does not return the billing time for subscription renewal or provide any accurate billing time. Instead, the server provides the subscription renewal time that may be slightly earlier than the billing time.
If you find the difference between the subscription renewal time and the time indicated by expirationDate is too big, you can submit a ticket online with the subscription order number or subscription ID for troubleshooting.
References
Home page of HUAWEI IAP
Development Guide of HUAWEI IAP