Szy*_*ski 5 android in-app-purchase in-app-billing google-play
将应用计费库更新为实现 'com.android.billingclient:billing:2.0.1' 后,即使 3 天后我也开始看到退款。这怎么可能?谷歌在这里只提到如果用户在购买后短时间内卸载应用程序,则购买退款。我想3天不是很短的时间。
小智 9
用户必须在 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")
}
}
}
Run Code Online (Sandbox Code Playgroud)
此代码将向 Google 服务器发送购买确认信息。因此,通过您的应用进行的任何购买都将不再无效,也不会自动退款。
| 归档时间: |
|
| 查看次数: |
1377 次 |
| 最近记录: |