【发布时间】:2019-06-19 06:52:34
【问题描述】:
将应用计费库更新为 实施 'com.android.billingclient:billing:2.0.1' 即使在 3 天后,我也开始看到退款。这怎么可能?谷歌只提到here,如果用户在购买后短时间内卸载应用程序,购买将被退款。我想3天不是很短的时间。
【问题讨论】:
标签: android google-play in-app-purchase in-app-billing
将应用计费库更新为 实施 'com.android.billingclient:billing:2.0.1' 即使在 3 天后,我也开始看到退款。这怎么可能?谷歌只提到here,如果用户在购买后短时间内卸载应用程序,购买将被退款。我想3天不是很短的时间。
【问题讨论】:
标签: android google-play in-app-purchase in-app-billing
用户必须在 3 天内确认购买,否则订阅将被退还:
https://developer.android.com/google/play/billing/billing_library_overview#acknowledge
【讨论】:
在 PurchasesUpdatedListener
中执行以下操作private val purchaseUpdateListener = PurchasesUpdatedListener { billingResult, purchases ->
for (purchase in purchases) {
if (purchase.purchaseState == Purchase.PurchaseState.PURCHASED) {
if (!purchase.isAcknowledged) {
val acknowledgePurchaseParams =
AcknowledgePurchaseParams.newBuilder()
.setPurchaseToken(purchase.purchaseToken).build()
billingClient?.acknowledgePurchase(acknowledgePurchaseParams) {
billingResult ->
val billingResponseCode = billingResult.responseCode
val billingDebugMessage = billingResult.debugMessage
Log.v("TAG_INAPP", "response code: $billingResponseCode")
Log.v("TAG_INAPP", "debugMessage : $billingDebugMessage")
}
}
}
此代码会将购买确认发送到 Google 服务器。因此,通过您的应用进行的任何购买都不会再无效,也不会自动退款。
【讨论】: