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

前端 未结 5 1521
感情败类
感情败类 2020-12-13 18:28

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

相关标签:
5条回答
  • 2020-12-13 18:43

    If you use a similar way than TrivialDriveKotlin, I post an functional answer in this post https://stackoverflow.com/a/61141740/1568148

    0 讨论(0)
  • 2020-12-13 18:45

    What I get from the Android developer site is that they prevent the purchase flow from at all getting to the point where you have to pay for it if it is a test purchase. It makes it easier because Google makes sure you do not pay for test purchases. It stops them within 14 days. The accounts that are to do that needs testing licences that you can activate from the Developer console.

    So you do not have to cancel them because technically you never purchased anything while at the same time you get to test what happens when something is bought. But the merchant center never recieves the request.

    EDIT:

    If you are to try to directly cancel and see what happens, do a real purchase and cancel it.

    0 讨论(0)
  • 2020-12-13 19:05

    This is an up-to-date Kotlin code that will consume all your purchases so you can buy them again. BE CAREFUL not to use this in production code, since doing this will surely have undesired behaviours.

    Clearly, you'll have to obtain your purchases previously.

    fun consumeAllTestPurchases(purchases: ArrayList<Purchase>) {
        purchases.value?.forEach {
            val consumeParams = ConsumeParams.newBuilder().setPurchaseToken(it.purchaseToken).build()
            billingClient.consumeAsync(consumeParams) { billingResult, _ ->
                if (billingResult.responseCode == BillingClient.BillingResponseCode.OK) {
                    var purchaseConsumed = true
                }
            }
        }
    }
    
    0 讨论(0)
  • 2020-12-13 19:06

    I am late to the question, but this is the most recent way to refund/cancel in-app purchases from Google. On you Google Play Console in the left hand menu there is a menu item called Order management. This brings up an order summary with a blue REFUND button at the bottom. Click this, select a reason for the refund and submit.

    Explanation on official docs

    0 讨论(0)
  • 2020-12-13 19:07

    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.

    0 讨论(0)
提交回复
热议问题