Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
340 views
in Technique[技术] by (71.8m points)

android - Cancelling orders on Google Play IAB test purchases after June 20, 2016

I have been using Google Play in-app purchases (IAPs) for a long time, but recently (June 20, 2016). They updated the Payments Merchant Center so that test purchases are not shown anymore. I quote a recent email to developers:

"Previously, test purchases for one-time IAPs generated order IDs. Starting June 20, 2016, one-time IAPs will not generate order IDs and will not appear in the Merchant Center."

I have found no information regarding purchases (not subscriptions) in the link: https://developer.android.com/google/play/billing/billing_testing.html The page has a "Canceling completed test purchases" that only comments on subscriptions.

My question is, where do I cancel a test purchase if they do not appear in the Payments Merchant Center?

UPDATE- Official answer from Google Support:

Thanks for contacting Google Play Developer Support. I checked into it, and the Play Developer Console doesn’t currently support the cancelation of test IAP. The only ways are to either consume the IAP or wait the 14 days consumption time.

UPDATE 2- Thanks to the answer below from Mike, I inserted the code below:

Purchase premiumPurchase = inventory.getPurchase(Constants.SKU_PRO);
if (premiumPurchase != null) {
    App.mHelper.consumeAsync(premiumPurchase, new IabHelper.OnConsumeFinishedListener() {
        @Override
        public void onConsumeFinished(Purchase purchase, IabResult result) {
            Log.d(TAG, "Test purchase is consumed.");
        }
    });
}

I only run this code to cancel the test purchase and debug the complete purchase flow again.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The easiest way to cancel an in-app purchase is to consume it. If you use the Google provided IabHelper you can just call consumeAsync and pass in the Purchase. I maintain a function to consume all the app's in-app products; this is essentially a billing reset function for testing.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...