Why in app product purchase in Google Play is automatically refunded?
Asked Answered
C

2

7

After updating the app billing lib to implementation 'com.android.billingclient:billing:2.0.1' I started to see refunds even after 3 days. How is that possible? Google only mentions here that purchse is refunded if user uninstall the app in short period after purchase. I guess 3 days is not a short period.

Copeland answered 19/6, 2019 at 6:52 Comment(0)
A
11

Users must acknowledge the purchase within 3 days otherwise the subscription will be refunded:

https://developer.android.com/google/play/billing/billing_library_overview#acknowledge

Apiarian answered 19/6, 2019 at 9:34 Comment(0)
S
5

Do the following in 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")
                        }
         }
 }

This code will send confirmation of the purchase to the google servers. So any purchase made from your app won't be invalid anymore and won't be refunded automatically.

Standby answered 21/12, 2020 at 7:39 Comment(1)
Hello and welcome to SO! While this code may answer the question, providing additional context regarding how and/or why it solves the problem would improve the answer's long-term value. Please read the tour, and How do I write a good answer?Electricity

© 2022 - 2024 — McMap. All rights reserved.