| CLASS info |
| public class InAppPurchaseData extends java.lang.Object |
| A utility class to parse InAppPurchaseData String. |
| Type | Name | Desc |
| static interface | InAppPurchaseData.PurchaseState | Possible state of a purchase. |
| Type | Name | Desc |
| static int | NOT_PRESENT | Indicates that the field is not present in source json string. |
| Constructor name |
InAppPurchaseData(java.lang.String iapData) Constructs an InAppPurchaseData from InAppPurchaseData String. |
| Return type | Method name |
| java.lang.String | getAppInfo() App information, which is reserved. |
| long | getApplicationId() the application id. |
| int | getCancelledSubKeepDays() Number of days for retaining a subscription relationship after the subscription is canceled. |
| int | getCancelReason() Cause of subscription cancellation. |
| long | getCancelTime() Timestamp of the subscription cancellation time. |
| java.lang.String | getCountry() Country code, which is used to identify a country. |
| java.lang.String | getCurrency() Currency |
| long | getDaysLasted() Days of paid service, excluding the free trial period and promotion period. |
| java.lang.String | getDeveloperPayload() developer provided payload |
| long | getExpirationDate() Timestamp of the subscription expiration time. |
| int | getExpirationIntent() Reason why a subscription expires. |
| int | getIntroductoryFlag() Indicates whether a subscription is in the promotion period. |
| java.lang.String | getLastOrderId() Order ID generated by the payment server during fee deduction on the previous renewal date. |
| int | getNotifyClosed() Indicates whether a user has disabled subscription notifications. |
| long | getNumOfDiscount() Number of successful renewal periods with promotion. |
| long | getNumOfPeriods() Number of successful standard renewal periods (that is, renewal periods without promotion). |
| java.lang.String | getOrderID() Order ID on the Huawei payment server, which uniquely identifies a transaction and is generated by the Huawei payment server during payment. |
| long | getOriPurchaseTime() Timestamp of the first fee deduction time, milliseconds since 00:00:00 on January 1, 1970. |
| java.lang.String | getPackageName() App installation package name. |
| long | getPrice() Value after the actual price of an in-app product is multiplied by 100. |
| int | getPriceConsentStatus() User opinion on the price increase of an in-app product. |
| java.lang.String | getProductGroup() ID of the subscription group to which a subscription belongs. |
| java.lang.String | getProductId() In-app product ID. |
| java.lang.String | getProductName() In-app product name. |
| int | getPurchaseState() Transaction status. |
| long | getPurchaseTime() Timestamp of the purchase time, milliseconds since 00:00:00 on January 1, 1970. |
| java.lang.String | getPurchaseToken() Purchase token, which uniquely identifies the mapping between an in-app product and a user and is generated by the Huawei payment server when the payment is complete. |
| int | getPurchaseType() Purchase type. |
| int | getQuantity() Purchase quantity. |
| long | getRenewPrice() Price used upon the next renewal. |
| int | getRenewStatus() Renewal status. |
| int | getRetryFlag() Indicates whether the system still tries to renew an expired subscription. |
| java.lang.String | getSubscriptionId() Subscription ID. |
| int | getTrialFlag() Indicates whether a subscription is in the free trial period. |
| boolean | isAutoRenewing() purchase auto renewing status. |
| boolean | isSubValid() true: A user has been charged for an in-app product, the in-app product has not expired, and no refund has been made. |
| int | Product type |
| java.lang.String | getDeveloperChallenge() Challenge defined when an app initiates a consumption request, which uniquely identifies the consumption request. This parameter exists only for one-off products. |
| int | getConsumptionState() Consumption status, which exists only for one-off products. |
| java.lang.String | Merchant ID, which uniquely identifies a transaction and is generated by the Huawei IAP server during payment. |
| java.lang.String | Payment method. |
| int | Indicates whether to postpone the settlement date. The value 1 indicates that the settlement date is postponed. |
| java.lang.String | Original subscription ID. |
| int | Subscription cancellation initiator. |
| long | Subscription cancellation time in UTC. |
| long | Time when a subscription is resumed. |
| int | getAccountFlag() Obtains the account type. |
| Constant |
| public static final int NOT_PRESENT |
| Indicates that the field is not present in source json string. |
| constructor |
| public InAppPurchaseData(java.lang.String iapData) throws org.json.JSONException |
| Constructs an InAppPurchaseData from InAppPurchaseData String. |
Parameters
| Parameter name | Parameter desc |
| iapData | String to describe user purchase details. |
Throws
| Parameter name | Parameter desc |
| org.json.JSONException | when mandatory field failed to parse from iapData. |
| Method |
| public long getApplicationId() |
| the application id. |
| Method |
| public java.lang.String getOrderID() |
| Order ID on the Huawei payment server, which uniquely identifies a transaction and is generated by the Huawei payment server during payment. |
| Method |
| public java.lang.String getPackageName() |
| App installation package name. |
| Method |
| public java.lang.String getProductId() |
| In-app product ID. Each in-app product must have a unique ID, which is maintained in the PMS or transferred to the PMS when the app initiates a purchase. |
| Method |
| public java.lang.String getProductName() |
| In-app product name. |
| Method |
| public long getPurchaseTime() |
| Timestamp of the purchase time, milliseconds since 00:00:00 on January 1, 1970. |
| Method |
| public int getPurchaseState() |
| Transaction status. |
| Method |
| public java.lang.String getDeveloperPayload() |
| developer provided payload. |
| Method |
| public int getPurchaseType() |
Purchase type. ● 0: in the sandbox ● 1: in the promotion period (not supported now) This parameter is not returned during formal purchase. |
| Method |
| public java.lang.String getCurrency() |
| Currency. |
| Method |
| public long getPrice() |
| Value after the actual price of an in-app product is multiplied by 100. The actual price is accurate to two decimal places. |
| Method |
| public java.lang.String getCountry() |
| Country code, which is used to identify a country. |
| Method |
| public java.lang.String getLastOrderId() |
| Order ID generated by the payment server during fee deduction on the previous renewal date. |
| Method |
| public java.lang.String getProductGroup() |
| ID of the subscription group to which a subscription belongs. |
| Method |
| public long getOriPurchaseTime() |
| Timestamp of the first fee deduction time, milliseconds since 00:00:00 on January 1, 1970. |
| Method |
| public java.lang.String getSubscriptionId() |
| Subscription ID. |
| Method |
| public int getQuantity() |
| Purchase quantity. |
| Method |
| public long getDaysLasted() |
| Days of paid service, excluding the free trial period and promotion period. |
| Method |
| public long getNumOfDiscount() |
| Number of successful renewal periods with promotion. |
| Method |
| public int getRetryFlag() |
| Indicates whether the system still tries to renew an expired subscription. |
| Method |
| public int getIntroductoryFlag() |
| Indicates whether a subscription is in the promotion period. |
| Method |
| public int getTrialFlag() |
| Indicates whether a subscription is in the free trial period. |
| Method |
| public java.lang.String getAppInfo() |
| App information, which is reserved. |
| Method |
| public int getNotifyClosed() |
| Indicates whether a user has disabled subscription notifications. |
| Method |
| public int getRenewStatus() |
Renewal status. ● 1: The subscription renewal is normal. ● 0: The user cancels subscription renewal. |
| Method |
| public long getRenewPrice() |
| Price used upon the next renewal. It is provided as a reference for users when the getPriceConsentStatus() parameter is returned. |
| Method |
Number of days for retaining a subscription relationship after the subscription is canceled. |
| Method |
| public int getKind() |
Product type. The options are as follows: ● 0: consumable ● 1: non-consumable ● 2: renewable subscription ● 3: non-renewable subscription |
| Method |
| public int getConsumptionState() |
| Consumption status, which exists only for one-off products. The options are as follows: ● 0: not consumed ● 1: consumed |
| Method |
| public int getPayOrderId() |
| Merchant ID, which uniquely identifies a transaction and is generated by the Huawei IAP server during payment. |
| Method |
| public int getDeferFlag() |
| Indicates whether to postpone the settlement date. The value 1 indicates that the settlement date is postponed. |
| Method |
| public int getCancelWay() |
| Subscription cancellation initiator. The options are 0 (user), 1 (developer), and 2 (Huawei). |
| Method |
| public int getCancellationTime() |
Subscription cancellation time in UTC. Note: cancelWay and cancellationTime are displayed when a subscription renewal stops (the refund is not involved). |
| Method |
| public long getResumeTime() |
| Time when a subscription is resumed. |
| Method |
| public int getAccountFlag() |
Obtains the account type. The options are as follows:
|