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
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) {
purchases.value?.forEach {
val consumeParams = ConsumeParams.newBuilder().setPurchaseToken(it.purchaseToken).build()
billingClient.consumeAsync(consumeParams) { billingResult, _ ->
if (billingResult.responseCode == BillingClient.BillingResponseCode.OK) {
var purchaseConsumed = true
}
}
}
}