In-App Purchases - Purchase/Subscription Process - Huawei Developers

Consumable Product Purchase Process
The following figure shows the typical process of purchasing a consumable product.
{
"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"
}
Process description:
1. Initiate a purchase request.
2. Request a delivery. Verify the signature of purchase details before delivering the requested product. If your app has high security requirements, further send a verification request to the Huawei IAP server through the Verifying the Purchase Token for the Order Service API on your app server.
3. Deliver the product and send the delivery token to your app server. Therefore, the delivery token is retrievable to avoid repeated deliveries even if the consumption fails.
4. Call the consumeOwnedPurchase API to consume the product and send a notification to the Huawei IAP server to update the delivery status. consumeOwnedPurchase is transferred to the API call request. After the consumption is complete, the Huawei IAP server resets the product status to available for purchase. Then the product can be purchased again.
Caution:
If you deliver a product after the consumption, the following exception may occur:
After receiving a consumption request from your app, the Huawei IAP server successfully consumes the product, but does not return the consumption result to your app due to network exceptions. As a result, the consumption already occurs, but the product is not delivered.
This exception is difficult to handle. You are advised to consume the product after the delivery.
Note:
1. This process is also applicable to offline games. The difference is that the tasks performed on your app server are executed by your app.
2. For details about the development process, please refer to the Development Guide.
Non-Consumable Product Purchase Process
The following figure shows the typical process of purchasing a non-consumable product.
1. Initiate a purchase.
2. Request a delivery. Verify the signature of purchase details before delivering the requested product. If your app has high security requirements, further send a verification request to the Huawei IAP server through the Verifying the Purchase Token for the Order Service API on your app server.
3. Deliver the product and send the delivery token to your app server. After the signature verification is successful, use the purchaseState field in the purchase data to determine the purchase status of the product. When the value of purchaseState is 0 (indicating that the product has been purchases), deliver the product.
Note:
For a non-consumable product, a user only needs to purchase the product once and can have it permanently. For details about how to provide services, please refer to Delivering a Non-Consumable Product.
For details about the development process, please refer to the Development Guide.
Subscription Process
The following figure shows the typical subscription process.
Note:
For details about the development process, please refer to Subscription Functions and Development Guide.

Related

How to send notification to devices from server with HMS Push Kit

{
"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"
}
Before we start learning about today’s topic, I strongly recommend you to go through my previous article i.e. How to know more about the client with Huawei Push Kit. It will help you to have a clear picture of HMS Push Kit.
Let’s Begin
Today in this article we are going to see how to send notification to devices from server using HMS Push Kit. To mimic the server part I am using POSTMAN. It is a great tool when trying to dissect RESTful APIs made by others or test ones you have made yourself. It offers a sleek user interface with which to make HTML requests, without the hassle of writing a bunch of code just to test an API's functionality.
1) The push token which we have received from client side (Mobile or web), we will store them in server side database.
2) Why do we need push token?
Earlier in my article we send a notification from Huawei developer console using push token. We will do the same here using POSTMAN.
3) We need our app Client Id and Client Secret to proceed further.
Actually here our client Id and client secret is our app id and app secret which we will be able to find in our AGC App information section.
4) We need to call two URL to serve the purpose. For both URL, protocol is POST.
   https://oauth-login.cloud.huawei.com/oauth2/v3/token
The above URL will help us to get App-Level Access Token. The Access token as we know expires every 60 minutes. So, we need to call them every 60 minutes if it get expires. This token is required to send notification.
i) POSTMAN Header Parameter
In the header parameter of POSTMAN, we need three Key-Value pair.
ii) POSTMAN Body Parameter
In the body parameter of POSTMAN, we need three Key-Value pair.
iii) The Result
After putting the header and the body parameters, we click the send button to get the access token as a result.
https://push-api.cloud.huawei.com/v1/[App ID]/messages:send
After receiving the App-Level Access token, we will use the token in HTTP header parameter to send notification. In the above URL we will replace App ID with our app id which we will obtained from AGC.
i) POSTMAN Params and Header Parameter
In the POSTMAN you will find a button name as Params. Click the button to put the Key and Value of Params.
In the Authorization value, a space character must be added between Bearer and the value of App-Level Access Token.
ii) POSTMAN Body
iii) The Result
Now What?
Well we can do many things like we can subscribe or unsubscribe to a topic, querying or deleting data as a controller or we can send receipts to a developer's receipt processing server using PUSH Kit Server APIs.
For more information, you can click this link https://forums.developer.huawei.com/forumPortal/en/home

Obtaining Data of Android Devices Between Google FCM and HUAWEI Push Kit

More information, you can visit HUAWEI Developer Forum and Medium.​
I work in operations for a mobile game. Recently, I was notified by the game's developers that HUAWEI Push Kit has been integrated into the Android version of the game. As we all know, the ability to push messages to users is a very important function. I proceeded to study some of the functions of Google Firebase Cloud Messaging (FCM) and HUAWEI Push Kit. Among the functions, I paid most attention to ones that had to do with data statistics. I have some interesting observations to share with you:
FCM: https://firebase.google.com/docs/cloud-messaging
HUAWEI Push Kit: https://developer.huawei.com/consumer/en/doc/development/HMS-Guides/push-introduction
1. Data Report
I am responsible for querying, browsing, exporting, and analyzing push data on the operations console every day. Therefore, the first thing I did was to compare the push reports.
{
"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"
}
Compared to FCM, HUAWEI Push Kit also reports the number of sent messages, number of received messages, and number of times messages were taped. Statistical methods and data items may vary slightly however. But most importantly, HUAWEI Push Kit is able to meet my data requirements.
2. Custom Data
During analysis, reports alone cannot help me completely analyze all push data. In addition to task-level data analysis, I also require custom analysis and status analysis based on a single message. For a specific message, FCM and HUAWEI Push Kit use different data processing methods.
BigQuery of FCM
https://firebase.google.com/docs/cloud-messaging/understand-delivery#bigquery_data_export
BigQuery is a large online data warehouse provided by Google. It supports online data querying and statistical analysis based on the SQL statement. Push data generated in FCM can be imported to BigQuery synchronously to implement custom statistical analysis of push data and allow you to view the data in more dimensions. BigQuery is suitable when you want to collect and query a large amount of data due to its fast processing and low maintenance costs.
No server is required either.
It is free of charge to export data from FCM, but I will be charged of using BigQuery.
HUAWEI message receipt:
https://developer.huawei.com/consumer/en/doc/development/HMS-Guides/push-receipt
After sending a message to a user device, HUAWEI Push Kit sends the message delivery status to your app server via a message receipt. Surprisingly, I discovered that the message receipt information is sent in real time.
A server, however, must be set up to receive receipt data.
The message receipt function is free of charge.
(Comments)
BigQuery is widely used and is not described here. Although HUAWEI Push Kit does not provide the same capabilities as BigQuery, it provides message receipts, which tell you the status of each message in real time and solve some of the following problems in certain scenarios:
1. Detecting problems with push messages in a timely manner: When an error occurs in a push message, I can discover this immediately since the message sending status is obtained in real time. This reduces the impact of the error.
2. Replacing SMS messages: At present, when I send a message that must be reached to a user, I require an SMS message of a carrier, which results in high costs. By using the message receipt, I can determine whether the message is received based on the receipt, which, to some extent, reduces the SMS messaging costs for some users.
3. Real-time effect analysis: Push data can be collected in a timely manner. For some important messages, I can obtain real-time push data and adjust push policies in a timely manner.
The message receipt provided by HUAWEI Push Kit is very useful in scenarios where we need to know message sending results in real time.
3. Conclusion
In conclusion, it is important for us to select the method most suitable for our specific product operations scenario.

A New Feature of HUAWEI In-App Purchases (IAP): Voucher Service

More and more apps and platforms now send vouchers to boost user acquisition and user engagement in multiple ways, such as through new user gifts, top-up gifts, shopping gifts, and sharing gifts.
Multiple types of vouchers configured in the IAP voucher service enrich the discounts in apps, so that each paid product can be purchased with the largest discount. This feature not only attracts users to use the app, but also makes users more willing to purchase products.
Now, let's learn about the voucher types, voucher configuration methods, and voucher usage process of the IAP voucher service.
Types of Vouchers
1. Price-break voucher: Deduct "X" from "Y" (Y > X)
Scope: product level, app level, cross-app level, and category level
Rule: one used at a time
For example, a user gets a price-break voucher to deduct CNY1 from CNY2. When the user purchases a relevant virtual product that costs more than CNY2, the user can use the voucher to deduct CNY1.
{
"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"
}
2. Percentage voucher: a percentage off the total amount of a product
Scope: product level, app level, cross-app level, and category level
Rule: one used at a time
For example, a user gets a 10% off voucher. When the user purchases a relevant virtual product, the user can enjoy a 10% discount from its original price.
3. Deduction voucher: a fixed amount off the cost
Scope: product level, app level, cross-app level, category level, and general
Rule: one or more used at a time
For example, a user gets several deduction vouchers of CNY1. When the user wants to buy a product in a voucher-allowed app, the user can use one or more deduction vouchers. The user can use deduction vouchers multiple times until the amount of deduction vouchers turns 0 as long as they are still within the validity period.
Configuration Methods of Vouchers
1. Creating a voucher
On the voucher creation page, enter the voucher information as required. Parameters marked with * are mandatory.
You need to fill in the following information:
Voucher title, voucher usage rule, names of voucher-allowed apps, applicable locations and currencies, preferential type (price-break voucher, percentage voucher, or deduction voucher), financial type (pure gift or gift-with-purchase), voucher's validity period, and distribution channel.
2. Creating a voucher campaign
On the voucher campaign creation page, enter the voucher information as required. Parameters marked with * are mandatory.
You need to fill in the following information:
Names of voucher-allowed apps, number of vouchers, campaign name, and campaign time.
Process of Voucher Usage
The IAP voucher service will be available soon

How to Secure Mobile Wallet Account? iCard Integrates the SysIntegrity API to Prevent Risks from Login Step

Overview
iCard is a popular mobile wallet app in Bulgaria. Backed by over 12 years of industry experience and a large user base, iCard provides services such as bank card management, collection and payment, international transfers, and foreign currency exchange for more than 30 countries and regions in Europe. How to ensure user account and transaction security and prevent itself from being attacked on risky devices have always been the key challenges of iCard.
{
"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"
}
Challenges
Risky devices undoubtedly affect app systems and users alike. Martin Dimitrov, head of mobile development team in iCard, said, "Jailbreak and root processes essentially alter the operating system and its security level. The more change that the operating system tolerates, the greater the likelihood that a legitimate app will be vulnerable after a device is jailbroken or rooted."
If a user is unaware that their device has been tampered with and signs in to and uses an app on the device, their account and personal data may be at risk and it can be difficult to check the system integrity of devices. iCard needs to integrate a powerful detection capability to check whether the device running the app is risky.
Solution – integrating SysIntegrity API
Fortunately, by integrating the SysIntegrity API of HUAWEI HMS Core Safety Detect Kit, iCard can quickly check whether the device is secure or rooted during user sign-in. SysIntegrity is free for developers to use and works using the Trusted Execution Environment (TEE), and helps app developers build security capabilities to protect user privacy and app security through tamper-proof and reliable check results.
Risk prevention, starting from App login
Martin Dimitrov said, "With SysIntegrity integrated, our app can detect risks once a user signs in to it on a rooted device, and it will then show a security warning to notify the user of possible risks, such as financial losses and information leaks." Furthermore, it only takes 1 person-day to integrate SysIntegrity.
(iCard app displays a message indicating that the phone is risky.)
Martin Dimitrov added, "After integrating SysIntegrity, the instances of risky sign-in on rooted phones have been reduced by around 10% which is a really good number. And we can also make the development process more convenient and efficient."
Results
The instances of risky sign-in on rooted devices reduced by about 10%.
User accounts and transactions are now well safeguarded.
Find out more on:
Huawei developers official page
Experience the easy-integration process on Codelabs
Submit a trouble ticket online for any problems during integration
Rediit: https://www.reddit.com/r/HuaweiDevelopers/
Github: https://github.com/HMS-Core/hms-safetydetect-demo-android
Stack Overflow: https://stackoverflow.com/questions/tagged/huawei-mobile-services?tab=Newest
Very interesting Security.

Recognize and Bind a Bank Card Through One Tap

{
"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"
}
Developments in mobile network technology have facilitated numerous errands in our daily life, for example, shopping online and offline, paying utility bills, and transferring money. Such convenience is delivered by apps with the payment function that often requires a card to be bound to user's account. Users have to complete the whole binding process themselves, by manually inputting a long bank card number, which is both time-consuming and error-prone. The bank card recognition service from ML Kit overcomes these drawbacks by automatically recognizing a bank card's key details. With it, mobile apps can provide a better user experience and thus improve their competitiveness.
Service Introduction​The service leverages the optical character recognition (OCR) algorithm to recognize a bank card from the image or camera streams (whose angle offset can be up to 15 degrees) captured from a mobile device. Then the service can extract key card details like the card number, validity period, and issuing bank. Extracted details are then automatically recorded into the app. It works with the ID card recognition service to provide a host of handy functions including identity verification and card number input, simplifying the overall user experience.
Demo​
Use Cases​Currently, binding bank cards is required by apps in a range of industries, including banking, mobile payment, and e-commerce. This service can accurately extract bank card details for the purpose of performing identity verification for financial services. Take an e-commerce app as an example. With the service integrated, such an app can record the bank card information that is quickly and accurately output by the service. In this way, the app lets users spend less time proving who they are and more time shopping.
Features​
Wide coverage of bank cards: This service supports mainstream bank cards such as China UnionPay, American Express, Mastercard, Visa, and JCB, from around the world.
Accurate and fast recognition: The service recognizes a card in just 566 milliseconds on average, delivering a recognition accuracy of over 95% for key details.
How to Integrate ML Kit?
For guidance about ML Kit integration, please refer to its official document. Also welcome to the HUAWEI Developers website, where you can find other resources for reference.

Categories

Resources