12
votes

I'm having a trouble with testing my in-app billing.
(using Google Play In-app Billing Version 3 API)

Problem:

Refunded in-app purchases are still present in the purchase list, which is provided by BillingClient.queryPurchases().

When I tried refunding purchases in January, refunded items were gone from the purchase list.

What I did:

  1. purchased some items as a tester.
    (I'm pretty sure a dialog said it's a test purchase.)
  2. refunded them in Google Play Console afterwards.
  3. wait until their payment statuses turned into "Refunded".
  4. cleared caches of Google Play Services & Google Play.
  5. checked my purchases BillingClient.queryPurchases() provides in my app.
  6. waited for a few days. reinstalled my app. All of them didn't work.

Minimal check code:

private val client: BillingClient // provided

fun check() {
    // client.startConnection() already completed here
    client.queryPurchases(BillingClient.SkuType.INAPP)
        .run {
            purchasesList
                .map     { it.originalJson }
                .forEach { Log.d("billing", "json = $it") }
        }
}

What I want to do:

I want to cancel all my test purchases.

Does anyone have any suggestions? Thank you in advance.

2
Unfortunately I can confirm this behavior. I've waited for 7 days and my refunded purchase was still available when querying my InApp purchases. (Using the new BillingClient api). I've then consumed the in app purchase via mBillingClient.consumeAsync() and tried it again. I made a new InApp purchase and refunded it. I'm already waiting for 3 days now, the purchase is still available in the application...jekatt
The problem still here, refunded purchases for items still return available as purchased (at least for test accounts). Tried reboot, tried to wait a week, tried to remove the accounts from test accounts - nothing help atm.Alex
Thanks, everyone answered. I consulted the support team. There are no ways to cancel refunded purchases, so we have to consume them manually. And we have API to collect cancelled items: developers.google.com/android-publisher/voided-purchases That's what I've got so far...Sosuke Ito
Anyone found a solution ? because this is very big issue. Once any user purchase premium version and cancel/refunded then he will be then premium user for life time. Actually in app billing itself should handle all this.Smeet
May 11 and this issue still exists. Anyone managed to solve this?Oz Shabat

2 Answers

4
votes

If your canceling doesn't remove your purchases from the query result you can consume them. They will then not be available anymore, when you make a new query and can be purchased again.

int response = client.consumePurchase(3, packageName, purchaseToken);

Managed in-app products are consumable, but subscriptions are not.

Source: developer.android.com

0
votes

Based from this documentation, currently, the In-app Billing API does not provide support for programmatically canceling subscriptions from inside the purchasing app. Then after a user cancels a subscription, the subscription is still active until the expiration date. Thus it stays visible in the Play Store app until the subscription expires. You may check this support page for more information.