store.consumePurchase not working

Every time I try to call store.consume Purchase, it does not work. I tried the method described in the docs, but it does work. The store.purchase function works, however.

store.consumePurchase( { “product1”, “product2” }, transactionCallback )

I am using the new Google Play v3 API. Can someone give an idea on what’s going wrong?

Please show us the log output, and a short snippet of code where you made the purchase.

local transactionCallback transactionCallback = function ( event ) local transaction = event.transaction if ( transaction.state == "purchased" ) then --handle a successful transaction here if( transaction.productIdentifier == "android.test.purchased" )then print("purchased") end --tell the store that the transaction is complete! --if you're providing downloadable content, do not call this until the download has completed store.finishTransaction( event.transaction ) store.consumePurchase( {"android.test.purchased"}, transactionCallback) end

This is my transactionCallback function that did not work when I tried testing it on my device.  The product isn’t consumed and I am always unable to consume the product twice.

Hi @Emerson Hsieh,

First of all, consuming purchases is not instantaneous. If you’re checking for consumption immediately after making the call, it probably won’t show up as consumed. Did you wait a few minutes to check the result?

Also, please read Google’s docs on consuming purchases, and make sure that the product type you’re trying to consume is correct:

http://developer.android.com/google/play/billing/api.html#consume

Best regards,

Brent

Hello Brent,

Thank you for your reply. I have tried replacing “Android.test.purchased” with my product SKU on the developer console. All of my products are managed, and the function successfully purchases my item when called. I have tried leaving the app for several minutes after calling the consumepurchase the way I did in my previous post, even leaving the app for an entire day to see if the item gets consumed but that does not happen.

Hi @Emerson Hsieh,

Is your intention that these purchases CAN be purchased multiple times? Meaning, the user can purchase it, then later, purchase it again, or even purchase 10 more of them?

Brent

HI I am having trouble with Inn App Purchase in the PlayStore. My game is published already but Can’t buy purchases, It say Purchase Fail.

Here what the terminal Consola showing:

07-05 19:34:10.324 12405-12442/? D/Finsky﹕ [1135] InAppBillingUtils.pickAccount: company.games.ColorballSplash: Account determined from library ownership - [1dIFE8-NYKXNUmFHyTxgEIQ_AUw]_

07-05 19:34:10.324 12405-12442/? W/Finsky﹕ [1135] InAppBillingManager.getBuyIntent: Input Error: Non empty/null argument expected for sku.

07-05 19:34:10.324 14483-14496/? E/IabHelper﹕ In-app billing error: Unable to buy item, Error response: 5:Developer Error

_07-05 19:34:13.799 12405-12415/? D/Finsky﹕ [1109] InAppBillingUtils.pickAccount: com.company.games.ColorballSplash: Account determined from library ownership - [1dIFE8-NYKXNUmFHyTxgEIQ_AUw]

07-05 19:34:13.799 12405-12415/? W/Finsky﹕ [1109] InAppBillingManager.getBuyIntent: Input Error: Non empty/null argument expected for sku.

07-05 19:34:13.799 14483-14496/? E/IabHelper﹕ In-app billing error: Unable to buy item, Error response: 5:Developer Error

07-05 19:34:13.804 14483-14483/? D/ProgressBar﹕ setProgress = 0

07-05 19:34:13.804 14483-14483/? D/ProgressBar﹕ setProgress = 0, fromUser = false

Anybody can help me , PLEASE

Please show us the log output, and a short snippet of code where you made the purchase.

local transactionCallback transactionCallback = function ( event ) local transaction = event.transaction if ( transaction.state == "purchased" ) then --handle a successful transaction here if( transaction.productIdentifier == "android.test.purchased" )then print("purchased") end --tell the store that the transaction is complete! --if you're providing downloadable content, do not call this until the download has completed store.finishTransaction( event.transaction ) store.consumePurchase( {"android.test.purchased"}, transactionCallback) end

This is my transactionCallback function that did not work when I tried testing it on my device.  The product isn’t consumed and I am always unable to consume the product twice.

Hi @Emerson Hsieh,

First of all, consuming purchases is not instantaneous. If you’re checking for consumption immediately after making the call, it probably won’t show up as consumed. Did you wait a few minutes to check the result?

Also, please read Google’s docs on consuming purchases, and make sure that the product type you’re trying to consume is correct:

http://developer.android.com/google/play/billing/api.html#consume

Best regards,

Brent

Hello Brent,

Thank you for your reply. I have tried replacing “Android.test.purchased” with my product SKU on the developer console. All of my products are managed, and the function successfully purchases my item when called. I have tried leaving the app for several minutes after calling the consumepurchase the way I did in my previous post, even leaving the app for an entire day to see if the item gets consumed but that does not happen.

Hi @Emerson Hsieh,

Is your intention that these purchases CAN be purchased multiple times? Meaning, the user can purchase it, then later, purchase it again, or even purchase 10 more of them?

Brent

HI I am having trouble with Inn App Purchase in the PlayStore. My game is published already but Can’t buy purchases, It say Purchase Fail.

Here what the terminal Consola showing:

07-05 19:34:10.324 12405-12442/? D/Finsky﹕ [1135] InAppBillingUtils.pickAccount: company.games.ColorballSplash: Account determined from library ownership - [1dIFE8-NYKXNUmFHyTxgEIQ_AUw]_

07-05 19:34:10.324 12405-12442/? W/Finsky﹕ [1135] InAppBillingManager.getBuyIntent: Input Error: Non empty/null argument expected for sku.

07-05 19:34:10.324 14483-14496/? E/IabHelper﹕ In-app billing error: Unable to buy item, Error response: 5:Developer Error

_07-05 19:34:13.799 12405-12415/? D/Finsky﹕ [1109] InAppBillingUtils.pickAccount: com.company.games.ColorballSplash: Account determined from library ownership - [1dIFE8-NYKXNUmFHyTxgEIQ_AUw]

07-05 19:34:13.799 12405-12415/? W/Finsky﹕ [1109] InAppBillingManager.getBuyIntent: Input Error: Non empty/null argument expected for sku.

07-05 19:34:13.799 14483-14496/? E/IabHelper﹕ In-app billing error: Unable to buy item, Error response: 5:Developer Error

07-05 19:34:13.804 14483-14483/? D/ProgressBar﹕ setProgress = 0

07-05 19:34:13.804 14483-14483/? D/ProgressBar﹕ setProgress = 0, fromUser = false

Anybody can help me , PLEASE