Why in app product purchase in Google Play is automatically refunded?

Viewed 2048

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.

2 Answers

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.

Related