Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android In-App Billing: Refunded in-app purchases not cancelled

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.

like image 474
Sosuke Ito Avatar asked Mar 08 '18 05:03

Sosuke Ito


People also ask

Can in-app purchases be refunded?

If it's been less than 48 hours since you bought an app or made an in-app purchase: You can request a refund through Google Play. If you bought movies, books, or other content: You may be able to request a refund more than 48 hours after your purchase (check policy below).

How do I get a refund for an in-app purchase on Android?

On any Android device linked to the account you made the purchase from, go to the Play Store page of the item you purchased and hit the Refund button. In the pop-up that appears, click Request refund to confirm.

How many refunds Does Google Play allow?

User returns a paid app: After purchasing a paid app, a user has up to 2 hours to return it for a full refund. They can only return an app once. If they purchase the same app again, they won't be able to return it a second time.


1 Answers

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

like image 100
jekatt Avatar answered Oct 21 '22 09:10

jekatt