[Huawei Developers] John Wo:
I have written series of article on Quick App. If you are new to Quick App refer my previous articles.

Quick App set up

A Novice Journey Towards Quick App ( Part 2 )

A Novice Journey Towards Quick App ( Part 3 )

Introduction

In App Purchase makes user to make online payment. In order make online payment in quick app let’s see how to integrate the IAP in Quick App.

Follow the steps

Step 1: Sign in to AppGallery Connect and select My projects.

Step 2: Select the project which you need to enable the service.

Step 3: Click the Manage API tab, Enable In-App purchase.

[IMG="https://communityfile-dre.op.hicloud.com/FileServer/getFile/cmtybbs/001/768/982/2640091000001768982.20201016105908.27875080675206137490529608687277:50511028005228:2800:179905B033F380F0EC104D08D3F68BC76BFD343107730855AD8509673F56E9E8.png"]https://communityfile-dre.op.hicloud.com/FileServer/getFile/cmtybbs/001/768/982/2640091000001768982.20201016105908.27875080675206137490529608687277:50511028005228:2800:179905B033F380F0EC104D08D3F68BC76BFD343107730855AD8509673F56E9E8.png[/IMG]

Above screen will show when Merchant service is not enabled. If you don’t have Merchant account follow the Enable Merchant service.

Step 4: Sign in to HUAWEI Developer. Click Console.

Step 5: Click App Services in the navigation bar on the left and select HUAWEI IAP.

[IMG="https://communityfile-dre.op.hicloud.com/FileServer/getFile/cmtybbs/001/768/982/2640091000001768982.20201016110018.23853367514122387507562085124898:50511028005228:2800:92AE9A0C09AFD4BAE61433B4FFE38B0E04D84A43D9FA2DDFB91232F3FBF4C945.png"]https://communityfile-dre.op.hicloud.com/FileServer/getFile/cmtybbs/001/768/982/2640091000001768982.20201016110018.23853367514122387507562085124898:50511028005228:2800:92AE9A0C09AFD4BAE61433B4FFE38B0E04D84A43D9FA2DDFB91232F3FBF4C945.png[/IMG]

Step 6: From the product list, find the app for which the HUAWEI IAP service will be configured. Then, click Update.

[IMG="https://communityfile-dre.op.hicloud.com/FileServer/getFile/cmtybbs/001/768/982/2640091000001768982.20201016110043.64548729290650396941071454994681:50511028005228:2800:9EB088CE9CDEB36002B645DBFA1150EC0084841DFFDB9A6D4ABC380ADA7342EF.png"]https://communityfile-dre.op.hicloud.com/FileServer/getFile/cmtybbs/001/768/982/2640091000001768982.20201016110043.64548729290650396941071454994681:50511028005228:2800:9EB088CE9CDEB36002B645DBFA1150EC0084841DFFDB9A6D4ABC380ADA7342EF.png[/IMG]

Step 7: Configure HUAWEI IAP service information.

[IMG="https://communityfile-dre.op.hicloud.com/FileServer/getFile/cmtybbs/001/768/982/2640091000001768982.20201016110104.76605643086027374219778348480965:50511028005228:2800:E0C8F018C73E22918307C1877E0D55ECA5A8DB9A92EE54C3E2080802B51D6690.png"]https://communityfile-dre.op.hicloud.com/FileServer/getFile/cmtybbs/001/768/982/2640091000001768982.20201016110104.76605643086027374219778348480965:50511028005228:2800:E0C8F018C73E22918307C1877E0D55ECA5A8DB9A92EE54C3E2080802B51D6690.png[/IMG]

Callback Address: can be modified after configuration. Ensure that the app's callback address can be visited. The value can contain a maximum of 255 characters and cannot end with a backslash (\). The callback address can be a multi-level domain name, where special characters such as underscores(_) cannot be contained. Note that callback address is not required for apps without a server.

Signed Certificate: Navigate to Tools > Certificate

Make sure you copy the generated certificates to sign > debug folder from the release folder.

[IMG="https://communityfile-dre.op.hicloud.com/FileServer/getFile/cmtybbs/001/768/982/2640091000001768982.20201016110128.37820706975478199602855131192513:50511028005228:2800:A61C4E0E3D71C2D6ADCC8CFC7DC82F140F23331A9FB14969CB2CC67F566F5C34.png"]https://communityfile-dre.op.hicloud.com/FileServer/getFile/cmtybbs/001/768/982/2640091000001768982.20201016110128.37820706975478199602855131192513:50511028005228:2800:A61C4E0E3D71C2D6ADCC8CFC7DC82F140F23331A9FB14969CB2CC67F566F5C34.png[/IMG]

[IMG="https://communityfile-dre.op.hicloud.com/FileServer/getFile/cmtybbs/001/768/982/2640091000001768982.20201016110144.48467908887564194170454979034272:50511028005228:2800:65D6E858E785D2E0EFE0D16D9F3078E3F145F2CA8C4CC85E4141C29F9BC2BE32.png"]https://communityfile-dre.op.hicloud.com/FileServer/getFile/cmtybbs/001/768/982/2640091000001768982.20201016110144.48467908887564194170454979034272:50511028005228:2800:65D6E858E785D2E0EFE0D16D9F3078E3F145F2CA8C4CC85E4141C29F9BC2BE32.png[/IMG]

Step 8: After completing the configuration, click Next, and then Submit.

Enable Merchant service

We need to be a merchant to make use of In-App Purchase in Quick App.

Note: Once your account becomes merchant, it takes 2-3 business day for verification.

Follow steps to enable merchant service

Step 1: Sign in to HUAWEI Developer. Click Console.

Step 2: In Settings, you will find Merchant Service as shown below.

[IMG="https://communityfile-dre.op.hicloud.com/FileServer/getFile/cmtybbs/001/768/982/2640091000001768982.20201016110205.79338148635655080963000608430184:50511028005228:2800:40BB497BE294385A3D349E9EF9F7786BF7F6FF6BE2CE7A2A1EDE51DA1E5CAE84.png"]https://communityfile-dre.op.hicloud.com/FileServer/getFile/cmtybbs/001/768/982/2640091000001768982.20201016110205.79338148635655080963000608430184:50511028005228:2800:40BB497BE294385A3D349E9EF9F7786BF7F6FF6BE2CE7A2A1EDE51DA1E5CAE84.png[/IMG]

Step 3: Enter the details in Bank information, as shown below.

[IMG="https://communityfile-dre.op.hicloud.com/FileServer/getFile/cmtybbs/001/768/982/2640091000001768982.20201016110219.87520782731559004193530085624434:50511028005228:2800:871FFC63A5E2D6912990F7011C4FB20B81ECA12C853D8582A1878D58346079F9.png"]https://communityfile-dre.op.hicloud.com/FileServer/getFile/cmtybbs/001/768/982/2640091000001768982.20201016110219.87520782731559004193530085624434:50511028005228:2800:871FFC63A5E2D6912990F7011C4FB20B81ECA12C853D8582A1878D58346079F9.png[/IMG]

Step 4: Enter details in Tax information node, as shown below.

[IMG="https://communityfile-dre.op.hicloud.com/FileServer/getFile/cmtybbs/001/768/982/2640091000001768982.20201016110237.90578224223958469147870527839615:50511028005228:2800:8632CD4D20FCBBAC176117F68AA6D6E9B43DD200E80C84ECF761F608DECF4BAC.png"]https://communityfile-dre.op.hicloud.com/FileServer/getFile/cmtybbs/001/768/982/2640091000001768982.20201016110237.90578224223958469147870527839615:50511028005228:2800:8632CD4D20FCBBAC176117F68AA6D6E9B43DD200E80C84ECF761F608DECF4BAC.png[/IMG]

Step 5: Click Submit to save the record for verification.

Create test account

Need sandbox account to test the IAP in quick App. During application development and testing we can use the sandbox account to make payment. During the testing period, when a purchase is initiated by the test account, the Huawei IAP server will identify the test account and directly process a successful payment, without real payments made.

Follow the steps to enable the sandbox account

Step 1: Navigate to AGC and select users and permissions.

Step 2: Select Test account, as shown below.

[IMG="https://communityfile-dre.op.hicloud.com/FileServer/getFile/cmtybbs/001/768/982/2640091000001768982.20201016110306.53563918058417224733601920585932:50511028005228:2800:4BFB4EA121F30458B5D177E79DD8FEAE66CC7E17BBBAA5A6EA93BD200E1073EC.png"]https://communityfile-dre.op.hicloud.com/FileServer/getFile/cmtybbs/001/768/982/2640091000001768982.20201016110306.53563918058417224733601920585932:50511028005228:2800:4BFB4EA121F30458B5D177E79DD8FEAE66CC7E17BBBAA5A6EA93BD200E1073EC.png[/IMG]

Step 3: Click Add button to add Test account, as shown below.

[IMG="https://communityfile-dre.op.hicloud.com/FileServer/getFile/cmtybbs/001/768/982/2640091000001768982.20201016110318.55208094792564393467289734494249:50511028005228:2800:4C6A6EBABEAB62E695E58C292E985FCD2B992C339A73D8E0F71A77C5EF3B473C.png"]https://communityfile-dre.op.hicloud.com/FileServer/getFile/cmtybbs/001/768/982/2640091000001768982.20201016110318.55208094792564393467289734494249:50511028005228:2800:4C6A6EBABEAB62E695E58C292E985FCD2B992C339A73D8E0F71A77C5EF3B473C.png[/IMG]

Huawei In-App purchase information

1. Sign in to HUAWEI Developer. Click Console.

2. Click App Services in the navigation bar on the left and select HUAWEI IAP.

3. Click the quick app for which HUAWEI IAP Service has been configured.

4. Find HUAWEI IAP Service parameters in the Service Info section.

APP ID: unique ID assigned by HUAWEI Developer to an app. Please store it properly for future use.

Payment ID: Used to configure the merchantId parameter in the development process.

Private key: RSA private key, used to sign the requested parameters when a developer's app invokes HMS SDK payment method.

Public key: RSA public key, used to verify the signature when a developer's app receives payment results from HMS SDK.

Result

Coming soon in next article.

Conclusion

In this article, we have learnt how integrate IAP in Quick App. In upcoming article I will continue the IAP adding products and product details and making payment online.

Reference

In-App Purchase official document