iapHelper.getOwnedList(HelperDefine.PRODUCT_TYPE_ALL, (errorVo, ownedList) -> {
if (errorVo.getErrorCode() == IapHelper.IAP_ERROR_NONE) {
for (OwnedProductVo item : ownedList) {
if (item.getIsConsumable()) {
// For consumable item, consume the item not yet consumed
iapHelper.consumePurchasedItems(item.getPurchaseId(), (errorVo, consumeList) -> {
// TODO: Handle the result
});
} else {
// For non-consumable item and subscription, acknowledge the purchase not yet acknowledged
if (item.getAcknowledgedStatus() == HelperDefine.AcknowledgedStatus.NOT_ACKNOWLEDGED) {
iapHelper.acknowledgePurchases(item.getPurchaseId(), (errorVo, acknowledgedList) -> {
// TODO: Handle the result
});
}
}
// Check if the subscription price has changed and user consent is required
SubscriptionPriceChangeVo subscriptionPriceChangeVo = item.getSubscriptionPriceChange();
if (subscriptionPriceChangeVo != null &&
subscriptionPriceChangeVo.getPriceChangeMode() == HelperDefine.PriceChangeMode.PRICE_INCREASE_USER_AGREEMENT_REQUIRED &&
!subscriptionPriceChangeVo.isConsented()) {
// TODO: Induce user consent
}
}
} else {
// TODO: Handle the error
}
});
Kotlin
iapHelper.getOwnedList(IapHelper.PRODUCT_TYPE_ALL)
{ errorVo: ErrorVo, ownedList: ArrayList<OwnedProductVo> ->
if (errorVo.errorCode == IapHelper.IAP_ERROR_NONE) {
for (item in ownedList) {
if (item.isConsumable) {
// For consumable item, consume the item not yet consumed
iapHelper.consumePurchasedItems(item.purchaseId) { errorVo: ErrorVo, consumeList: ArrayList<ConsumeVo> ->
// TODO: Handle the result
}
} else {
// For non-consumable item and subscription, acknowledge the purchase not yet acknowledged
if (item.acknowledgedStatus == HelperDefine.AcknowledgedStatus.NOT_ACKNOWLEDGED) {
iapHelper.acknowledgePurchases(item.purchaseId) { errorVo: ErrorVo, acknowledgedList: ArrayList<AcknowledgeVo> ->
// TODO: Handle the result
}
}
}
// Check if the subscription price has changed and user consent is required
val subscriptionPriceChangeVo = item.subscriptionPriceChange
if (subscriptionPriceChangeVo != null &&
subscriptionPriceChangeVo.priceChangeMode == HelperDefine.PriceChangeMode.PRICE_INCREASE_USER_AGREEMENT_REQUIRED &&
!subscriptionPriceChangeVo.isConsented {
// TODO: Induce user consent
}
}
} else {
// TODO: Handle the error
}
}
Note: When displayed, this string always includes the two digits to the right of the decimal point (and does not display the currency symbol). For example, if the local price is 8 euros, the value "8.00" is displayed. If you don't want to display the decimal point and the two digits to the right of the decimal point when the price is a whole number, use getItemPriceString() instead.
getItemPriceString()
String
本地货币符号和价格(本地货币格式):
货币符号 + 价格(例如 £7.99)
价格 + 货币符号(例如 66815₫)
Note: When displayed, this string always includes the two digits to the right of the decimal point (and does not display the currency symbol). For example, if the local price is 8 euros, the value "8.00" is displayed. If you don't want to display the decimal point and the two digits to the right of the decimal point when the price is a whole number, use getItemPriceString() instead.
Note: When displayed, this string always includes the two digits to the right of the decimal point (and does not display the currency symbol). For example, if the local price is 8 euros, the value "8.00" is displayed. If you don't want to display the decimal point and the two digits to the right of the decimal point when the price is a whole number, use getItemPriceString() instead.
getItemPriceString()
String
本地货币符号和价格(本地货币格式):
货币符号 + 价格(例如 £7.99)
价格 + 货币符号(例如 66815₫)
Note: When displayed, if the price is a whole number, the decimal point and the two digits to the right of the decimal point are not displayed. For example, if the local price is 8 euros, the value "€8" is displayed. If you want to display the two digits to the right of the decimal point (even if the price is a whole number), use getItemPrice() instead.
状态消息 0 : "success" 1 : "Can't find order with this purchaseID." 2 : "This is not successful order." 3 : "This type of item is not consumable/non-consumable." 4 : "This purchase has been consumed/acknowledged already." 5 : "Can't consume/acknowledge this purchase because the user is not authorized to consume this order." 9 : "service error"
getJsonString()
String
完全 JSON 有效负载
代码片段
Java (ConsumeVo)
final String PURCHASEID = "d215d9abcd17b12578a21c0ea7d8821747b64939732a3243b538d8bcae245590";
iapHelper.consumePurchasedItems(PURCHASEID, (errorVo, consumeList) -> {
if (errorVo.getErrorCode() == IapHelper.IAP_ERROR_NONE) {
for (ConsumeVo item : consumeList) {
// TODO: Get details of the consumption
}
} else {
// TODO: Handle the error
}
});
Kotlin (AcknowledgeVo)
val PURCHASEID: String = "d215d9abcd17b12578a21c0ea7d8821747b64939732a3243b538d8bcae245590"
iapHelper.acknowledgePurchases(PURCHASEID)
{ errorVo: ErrorVo, acknowledgedList: ArrayList<AcknowledgeVo> ->
if (errorVo.errorCode == IapHelper.IAP_ERROR_NONE) {
for (item in acknowledgedList) {
// TODO: Get details of the acnowledge
}
} else {
// TODO: Handle the error
}
}
iapHelper.getPromotionEligibility("Nuclear, Claymore, SpeedUp", (errorVo, pricingList) -> {
if (errorVo.getErrorCode() == IapHelper.IAP_ERROR_NONE) {
for (PromotionEligibilityVo pricing : pricingList) {
// TODO: Get the pricing options of the subscription
}
} else {
// TODO: Handle the error
}
});
Kotlin
iapHelper.getPromotionEligibility("Nuclear, Claymore, SpeedUp")
{ errorVo: ErrorVo, pricingList: ArrayList<PromotionEligibilityVo> ->
if (errorVo.errorCode == IapHelper.IAP_ERROR_NONE) {
for (item in pricingList) {
// TODO: Get the pricing options of the subscription
}
} else {
// TODO: Handle the error
}
}
We use cookies to improve your experience on our website and to show you relevant
advertising. Manage you settings for our cookies below.
Essential Cookies
These cookies are essential as they enable you to move around the website. This
category cannot be disabled.
Company
Domain
Samsung Electronics
.samsungdeveloperconference.com
Analytical/Performance Cookies
These cookies collect information about how you use our website. for example which
pages you visit most often. All information these cookies collect is used to improve
how the website works.
Company
Domain
LinkedIn
.linkedin.com
Meta (formerly Facebook)
.samsungdeveloperconference.com
Google Inc.
.samsungdeveloperconference.com
Functionality Cookies
These cookies allow our website to remember choices you make (such as your user name, language or the region your are in) and
tailor the website to provide enhanced features and content for you.
Company
Domain
LinkedIn
.ads.linkedin.com, .linkedin.com
Advertising Cookies
These cookies gather information about your browser habits. They remember that
you've visited our website and share this information with other organizations such
as advertisers.
Company
Domain
LinkedIn
.linkedin.com
Meta (formerly Facebook)
.samsungdeveloperconference.com
Google Inc.
.samsungdeveloperconference.com
Preferences Submitted
You have successfully updated your cookie preferences.