• Introducing XDA Computing: Discussion zones for Hardware, Software, and more!    Check it out!

In-App Purchases - Purchase/Subscription Process

Search This thread

XDARoni

XDA Community Manager
Consumable Product Purchase Process
The following figure shows the typical process of purchasing a consumable product.

xBH0xT8.png

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.
NfPVJTf.png


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.
pRucFOZ.png

Note:
For details about the development process, please refer to Subscription Functions and Development Guide.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 7
    Consumable Product Purchase Process
    The following figure shows the typical process of purchasing a consumable product.

    xBH0xT8.png

    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.
    NfPVJTf.png


    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.
    pRucFOZ.png

    Note:
    For details about the development process, please refer to Subscription Functions and Development Guide.