Purchase data model, which supports consumables and non-consumables.
| Name | Mandatory | Type | Description |
|---|---|---|---|
| applicationId | Yes | number | App ID. |
| applicationIdString | Yes | string | App ID in character string format. |
| autoRenewing | Yes | boolean | For consumables or non-consumables, the value is always false. |
| orderId | Yes | string | Order ID, which uniquely identifies a receipt to be charged. It is generated by the IAP server when an order is created or a subscription is renewed. Each receipt matches a unique order ID. |
| kind | Yes | number | Product type. The options are as follows:
|
| packageName | No | string | App package name. |
| productId | Yes | string | Product ID. NOTE: After a successful verification of the signature in the payment result, it is a must to check the consistency of this parameter value between IAP Kit and your app. |
| productName | No | string | Product name. |
| purchaseTime | No | number | Time when a product is purchased. The value is a UTC timestamp, in milliseconds. If the purchase is not complete, this parameter is left empty. |
| purchaseTimeMillis | No | number | A parameter that has the same meaning as purchaseTime and used by APIs of earlier versions. If your app has the latest version integrated, just ignore this parameter. |
| purchaseState | Yes | number | Purchase status. The options are as follows:
|
| developerPayload | No | string | Information stored on the merchant side, which an app passes when calling the payment API. |
| developerChallenge | No | string | Challenge defined when an app initiates a consumption request, which uniquely identifies the consumption request. |
| consumptionState | No | number | Consumption status. The options are as follows:
|
| confirmed | No | number | Acknowledgement status. The options are as follows:
NOTE: This parameter is used only for compatibility with earlier versions. If your app has the latest version integrated, just ignore this parameter. |
| purchaseToken | Yes | string | Purchase token, which uniquely identifies the mapping between a product and a user. It is generated by the IAP server when a payment is complete. NOTE:
|
| purchaseType | No | number | Purchase type.
This parameter is not returned during formal purchase. |
| currency | No | string | Currency. For example, CNY. NOTE: After a successful verification of the signature in the payment result, it is a must to check the consistency of this parameter value between IAP Kit and your app. |
| price | No | number | Value after the actual price of a product is multiplied by 100. The actual price is accurate to two decimal places. For example, if the value of this parameter is 501, the actual product price is 5.01. NOTE: After a successful verification of the signature in the payment result, it is a must to check the consistency of this parameter value between IAP Kit and your app. |
| country | No | string | Country or region code, which is used to identify a country or region. The value must comply with the ISO 3166 standard. |
| payType | No | string | Payment method. For details about its values, please refer to payType. |
| payOrderId | No | string | Order ID, which is generated after a user successfully makes a payment. |
Below lists the values of payType.
| Value | Description |
|---|---|
| 0 | HUAWEI Points. |
| 4 | Alipay. |
| 94 | Huawei Pay. |
It contains order information and subscription status information in JWS format.
| Name | Mandatory | Type | Description |
|---|---|---|---|
| type | Yes | number | Product type.
|
| jwsPurchaseOrder | No | string | Data in JWS format that contains order information. Follow the instructions in Verifying the Signature in the Returned Result to decode and perform signature verification for the returned result to obtain purchase data in JSON format. Check the parameters in the JSON string in PurchaseOrderPayload. |
| jwsSubscriptionStatus | No | string | Data in JWS format that contains subscription status information. Follow the instructions in Verifying the Signature in the Returned Result to decode and perform signature verification for the returned result to obtain subscription status information in JSON format. Check the parameters in the JSON string in SubGroupStatusPayload. |
Order information model, which supports consumables, non-consumables, and auto-renewable subscriptions.
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| environment | Yes | string | Environment type.
|
| purchaseOrderId | Yes | string | Order ID of a purchase. |
| purchaseToken | Yes | string | Purchase token. In a consumable/non-consumable purchase, each purchase token matches a specific order. In a subscription purchase, each purchase token matches a subscription ID. |
| applicationId | Yes | string | App ID. |
| productId | Yes | string | Product ID. |
| productType | Yes | string | Product type. The options are as follows:
|
| purchaseTime | Yes | number | Time when a product is purchased. The value is a UTC timestamp, in milliseconds. If the purchase is not complete, this parameter is left empty. |
| finishStatus | No | string | Delivery status. The options are as follows:
|
| needFinish | No | boolean | Indicates whether it is a must to acknowledge the delivery to complete the purchase. The options are as follows:
|
| price | Yes | number | Price, in cents. |
| currency | Yes | string | Currency. For details, please refer to the ISO 4217 standard. For example, CNY, USD, and MYR. |
| developerPayload | No | string | Information stored on the merchant side, which an app passes when calling the payment API. |
| purchaseOrderRevocationReasonCode | No | string | Reason for revoking an order.
|
| revocationTime | No | number | Time when an order is revoked. The value is a UTC timestamp, in milliseconds. |
| offerTypeCode | No | string | Offer type.
|
| offerId | No | string | Offer ID. |
| countryCode | Yes | string | Country or region code, which is used to identify a country or region. The value must comply with the ISO 3166 standard. |
| signedTime | Yes | number | Time when signing is performed. The value is a UTC timestamp, in milliseconds. |
| Parameters returned only for subscriptions: | |||
| subGroupGenerationI | Yes | string | Generation ID of a subscription group.
|
| subscriptionId | Yes | string | Subscription ID. The ID will changes when:
|
| subGroupId | Yes | string | Subscription group ID. |
| duration | Yes | string | Validity period after a purchase. The value is in ISO 8601 format. For example, P1W indicates a week and P1M indicates a month. |
| durationTypeCode | Yes | string | Type of a subscription cycle.
|
Subscription status information related to a subscription group.
| Name | Mandatory | Type | Description |
|---|---|---|---|
| environment | Yes | string | Environment type.
|
| applicationId | Yes | string | App ID. |
| packageName | Yes | string | App package name. |
| subGroupId | Yes | string | Subscription group ID. |
| lastSubscriptionStatus | No | object | Final subscription status (SubscriptionStatus) within a subscription group. For example, if a user switches from subscription A to B and then to C, this parameter indicates the status of subscription C. |
| historySubscriptionStatusList | No | object[] | List of all historical subscription statuses (SubscriptionStatus) within a subscription group. For example, if a user switches from subscription A to B and then to C, this parameter indicates the statuses of subscriptions C, B, and A. |
Information about the subscription status.
| Name | Mandatory | Type | Description |
|---|---|---|---|
| subGroupGenerationId | Yes | string | Generation ID of a subscription group.
|
| subscriptionId | Yes | string | Subscription ID. The ID will changes when:
|
| purchaseToken | Yes | string | Purchase token. In a consumable/non-consumable purchase, each purchase token matches a specific order. In a subscription purchase, each purchase token matches a subscription ID. |
| status | Yes | string | Subscription status.
|
| expiresTime | Yes | number | Time when a subscription expires. The value is a UTC timestamp, in milliseconds. |
| lastPurchaseOrder | No | object | Latest order for a subscription. For details about the included parameters, please refer to PurchaseOrderPayload. |
| recentPurchaseOrderList | No | object[] | List of the latest orders for a subscription, including those generated upon renewal and balance conversion. For details about the included parameters, please refer to PurchaseOrderPayload. |
| renewalInfo | No | object | Latest future billing plan for a subscription. For details about the included parameters, please refer to SubRenewalInfo. |
Information about the billing plan for a subscription.
| Name | Mandatory | Type | Description |
|---|---|---|---|
| environment | Yes | string | Environment type.
|
| subGroupGenerationId | Yes | string | Generation ID of a subscription group.
|
| nextRenewPeriodProductId | No | string | ID of the product to be purchased on the next billing date. |
| productId | Yes | string | ID of the product that is currently active. |
| autoRenewStatusCode | Yes | string | Auto-renewal status.
|
| hasInBillingRetryPeriod | Yes | boolean | Indicates whether the system is still attempting to charge.
|
| priceIncreaseStatusCode | No | string | Price increase status code.
|
| offerTypeCode | No | string | Offer type.
|
| offerId | No | string | Offer ID. |
| renewalPrice | No | number | Price charged for the next renewal, in cents. This parameter is not returned in the subscription cancellation scenario. |
| currency | No | string | Currency. For details, please refer to the ISO 4217 standard. For example, CNY, USD, and MYR. |
| renewalTime | No | number | Time when a renewal happens. The value is a UTC timestamp, in milliseconds. |
| expirationIntent | No | string | Reason for subscription renewal failure.
|