目录

Data Models

InappPurchaseDetails

The following table describes the model parameters.

Parameter

Mandatory

Type

Description

applicationId

Yes

Long

App ID.

autoRenewing

Yes

Boolean

For consumables or non-consumables, the value is always false.

For subscriptions, the options are as follows:

  • true: A subscription is in active state and will be automatically renewed on the next renewal date.
  • false: A user has canceled the subscription. The user can access the subscribed content only before the next renewal date, unless automatic renewal is enabled. If a grace period is applicable, this value remains true for the subscription during the grace period. The next payment date is automatically deferred every day until the grace period ends or the user changes the payment method.

orderId

Yes

String

Order ID, which uniquely identifies a receipt that waits to be paid. The order ID is generated by the Huawei IAP server when it creates an order for a consumable or a non-consumable or when it renews a subscription.

Each receipt matches a unique order ID.

kind

Yes

Integer

Product type. The options are as follows:

  • 0: consumable
  • 1: non-consumable
  • 2: subscription

packageName

No

String

App package name.

productId

Yes

String

Product ID. Each product must have a unique ID, which is maintained in the PMS or passed when the app initiates a purchase.

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 HUAWEI IAP and your app.

productName

No

String

Product name.

purchaseTime

No

Long

UTC timestamp (in milliseconds) when a product is purchased.

purchaseTimeMillis

No

Long

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

Integer

Transaction status. The options are as follows:

  • -1: initialized
  • 0: purchased
  • 1: canceled
  • 2: canceled or refunded
  • 3: pending

developerPayload

No

String

Information stored on the merchant side, which is passed by the app when the payment API is called.

NOTE:

Do not pass sensitive personal information.

developerChallenge

No

String

Challenge defined when an app initiates a consumption request. The challenge uniquely identifies the consumption request and exists only for one-off products.

consumptionState

No

Integer

Consumption status, which exists only for one-off products. The options are as follows:

  • 0: not consumed
  • 1: consumed

confirmed

No

Integer

Confirmation status. The options are as follows:

  • 0: not confirmed
  • 1: confirmed
  • If this parameter is left empty, no confirmation is required.
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 Huawei IAP server when the payment is complete.

NOTE:
  • This parameter uniquely identifies the mapping between a product and a user. It does not change when the subscription is renewed.
  • Currently, the value contains 92 characters and its length may be expanded. If the value needs to be stored, you are advised to reserve 128 characters.
  • You are advised to encrypt the purchase token before storing it, to ensure security.

purchaseType

No

Integer

Purchase type. The options are as follows:

  • 0: in the sandbox
  • 1: in the promotional period (currently unsupported)

This parameter is not returned during formal purchase.

currency

No

String

Currency. The value must comply with the ISO 4217 standard.

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 HUAWEI IAP and your app.

price

No

Long

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 HUAWEI IAP 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 the value, please refer to payType.

payOrderId

No

String

Transaction ID, which is generated after a user successfully makes a payment.

The following parameters are returned only in the subscription scenario.

lastOrderId

Yes

String

ID of the last renewal order, which is generated by the Huawei IAP server during fee deduction. The parameter value is the same as that of orderId when a subscription is purchased for the first time.

productGroup

No

String

ID of the subscription group to which a subscription belongs.

oriPurchaseTime

No

Long

Original purchase time, that is, the UTC timestamp (in milliseconds) when a subscription is successfully charged for the first time.

subscriptionId

No

String

Subscription ID.

NOTE:

This parameter uniquely identifies the mapping between a product and a user. It does not change when the subscription is renewed.

oriSubscriptionId

No

String

Original subscription ID. If a value exists, the current subscription is switched from another one. The value can be associated with the information about the original subscription.

quantity

No

Integer

Purchase quantity.

daysLasted

No

Long

Days of a paid subscription, excluding the free trial period and promotional period.

numOfPeriods

No

Long

Number of successful standard renewal periods (that is, renewal periods without promotion). If the value is 0 or does not exist, no renewal has been performed successfully.

numOfDiscount

No

Long

Number of successful renewals included in a promotional activity.

expirationDate

No

Long

UTC timestamp (in milliseconds) when a subscription expires.

For an automatic renewal receipt with successful billing, this parameter indicates the renewal or expiration time. If the value is a past time for the latest receipt of a subscription, the subscription has expired.

expirationIntent

No

Integer

Reason why a subscription expires. The options are as follows:

  • 1: canceled by a user
  • 2: product unavailable
  • 3: abnormal user signing information
  • 4: billing error
  • 5: price increase disagreed with by a user
  • 6: unknown error

If there are multiple exceptions, a smaller number indicates a higher priority (1 > 2 > 3...).

retryFlag

No

Integer

Indicates whether the system still tries to renew an expired subscription. The options are as follows:

  • 0: no
  • 1: yes

introductoryFlag

No

Integer

Indicates whether a subscription is in the renewal period with promotion. The options are as follows:

  • 1: yes
  • 0: no

trialFlag

No

Integer

Indicates whether a subscription is in the free trial period. The options are as follows:

  • 1: yes
  • 0: no

cancelTime

No

Long

UTC timestamp (in milliseconds) when a subscription is revoked. A refund is made after revocation and the service is unavailable immediately. A value is returned when a user:

  • Makes a complaint and revokes a subscription through the customer service personnel.
  • Performs subscription upgrade or crossgrade that immediately takes effect and revokes the previous receipt of the original subscription.
NOTE:

If a receipt is revoked, the purchase is considered as not complete.

cancelReason

No

Integer

Cause of subscription cancellation. The options are as follows:

  • 3: A user initiates a refund or cancellation request. If cancelTime is empty, the subscription cancellation is caused by a refund request.
  • 2: A user performs subscription upgrade or crossgrade.
  • 1: A user encounters a problem within the app and cancels the subscription.
  • 0: other causes. For example, a user mistakenly purchases a subscription and has to cancel it.
NOTE:

If this parameter is left empty but the cancelTime parameter has a value, the cancellation is caused by an operation such as upgrade.

appInfo

No

String

App information. This parameter is reserved.

notifyClosed

No

Integer

Indicates whether a user has disabled the subscription notification function. The options are as follows:

  • 1: yes
  • 0: no

If the user disables the subscription notification function, no subscription notification will be sent to this user.

NOTE:

A value is returned only when subscription relationships are queried.

renewStatus

No

Integer

Renewal status. The options are as follows:

  • 1: The subscription will automatically renew at the end of the current subscription period.
  • 0: The user has canceled subscription renewal.

For auto-renewable subscriptions, this parameter is valid for both valid and expired subscriptions. However, it does not represent users' subscription status. Generally, when the value is 0, the app can provide other subscription options for the user, for example, recommending another subscription with a lower level in the same group. The value 0 indicates that a user proactively cancels the subscription.

priceConsentStatus

No

Integer

User opinion on the price increase of a product. The options are as follows:

  • 1: The user has agreed with the price increase.
  • 0: The user does not respond to the price increase. After the subscription expires, it becomes invalid.

renewPrice

No

Long

Price used upon the next renewal. It is provided as a reference for users when the priceConsentStatus parameter is returned.

subIsvalid

No

Boolean

  • true: A user has been charged for a product, the product has not expired, and no refund has been made; or a product is in a grace period. In this case, you can provide services for the user.
  • false: The purchase of a product is not finished, the product has expired, or a refund has been made for the product after its purchase.
NOTE:

If a user has canceled a subscription, the value of subIsvalid remains true until the subscription expires.

deferFlag

No

Integer

Indicates whether to postpone the order settlement.

  • 1: yes
  • Values other than 1: no

cancelWay

No

Integer

Subscription cancellation initiator. The options are as follows:

  • 0: user
  • 1: you
  • 2: Huawei

cancellationTime

No

Long

UTC timestamp (in milliseconds) when a user cancels a subscription. In the time, you set a subscription renewal to be stopped in the future. The subscription is still valid within the validity period, but the renewal will be stopped in the future. No refund is required.

NOTE:

cancellationTime is returned when a subscription renewal stops (no refund is involved).

cancelledSubKeepDays

No

Integer

Number of days for retaining a subscription relationship after the subscription is canceled. (In these days, the user can resume the subscription anytime as needed.)

resumeTime

No

Long

UTC timestamp (in milliseconds) when a paused subscription is resumed.

surveyReason

No

Integer

Cancellation reason. The options are as follows:

0: others

1: too high fee

2: technical problem, for example, product not provided

5: in the blocklist because of fraud

7: subscription switchover

9: service being rarely used and not required

10: other better apps

surveyDetails

No

String

When the value of surveyReason is 0, this parameter is used to collect the cancellation reason entered by users.

graceExpirationTime

No

Long

UTC timestamp (in milliseconds) when the grace period of a subscription ends.

payType

Value

Description

0

HUAWEI Point

3

Credit card

4

Alipay

6

DCB

13

PayPal

16

Debit card

17

WeChat Pay

19

Gift card

20

Balance

21

HUAWEI Point card

23

callfee

24

World Pay

31

HUAWEI Wallet

32

Alipay Huabei

33

SHARINGPAY

34

bankCard

35

Ideal

36

OpenBK

37

Sofort

38

giropay

39

FPX

40

eNets

41

BOOST

42

Sberbank

43

eMoney

44

Huabei

45

Coupon (HMS coupon)

46

eMoney4MP

47

2C2PBank

48

TrueMoney

49

Combined payment using gift cards and HMS coupons

61

GCash

62

BPIOnline

63

UnionBankOnline

64

alipay_hk

65

DANA

66

TNG

67

PaymentWall

68

paymaya_wallet

69

PSafeCard

70

MPESA

71

BankCard

72

WXPay

73

AliPay

74

Boost

75

oxxopay

76

ALIPAY_HK

77

GCASH

78

Efecty

79

Multicaja

80

PayAtFawry

81

Point (paid only with membership points)

82

HWPay4Petal

83

TRUEMONEY

84

MIR

85

Boost

86

vtcpay

88

Webpay

89

PSE

90

ozow

93

ShopeePay

94

Huawei Pay

95

UnionPay

97

QIWI

98

trustly

99

knet

100

pagoefectivo

102

Tinkoff

103

WeChat Pay HK

105

AliPayCN

106

MercadoPago

108

QIWI bank card

109

PIX

110

Maya

113

VKPay bank card