How to deal with in app purchases?

I briefly looked over it and didn’t see anything obvious. Hopefully I’ll get some time today to look at it.

Ok, thank you very much.

Can you build and post APK?  I’m getting an authentication error.  Otherwise I don’t see anything obvious in the code that would cause the window to pop up twice.

Yes, here it is:

Sorry, in fact, I cannot attach it to the message… It says: "Error You aren’t permitted to upload this kind of file".

You will have to upload the APK somewhere and post a URL here.

Also I looked at the code you sent and it’s not a valid test case. I can’t just build it and run it. For instance I doubt your product is really named “productName” in your store.purchase() API calls.

Since I don’t have enough information to test against your IAP setup, I went ahead and tested against the Android default items:

android.test.purchased

I hit the purchase button, I got one dialog set and was able to purchase the fake item. Of course it errored out when trying to check licensing which I expected. I can only test this on Android since Apple doesn’t have a similar fake product and I’d have to setup all your items.

That said there is a bug in the transaction listener for revoking the transaction. It never calls finish transaction.

If you want me to test against your installation, I’ll need the licensing key, your AppID that you’re building with and the product name you’re trying to buy.

Rob

Rob

Thanks for your reply. I will post a URL very soon.

Rob, could I send you the information you ask for personnally? I noticed that we cannot send you personal messages.

Pierre

Check your email.

Rob, do you want the information for the app I created specifically for the test of IAPs or for my real game?

I need whatever I need to put in the app and build it and see the problem.

I have sent to you the information on the app I created specifically and whose code was published not long ago in the ZIP file.

Hi,

Here is the URL: https://play.google.com/apps/testing/com.acme.game.test

Other than a crash at the end after the purchase was completed, it worked exactly as it should. I got no double dialog boxes.

Rob

Thank you very much for your reply.

Ok, so you built the project I posted and then ran it on a device and everything worked as it should, without any error and the pruchase was successeful?

And, did you try the apk with the URL I posted?

Pierre

If I build my own copy of the source you sent, with your product ID I get an “Invalid product” error.

If I run the APK you produced, it ran successfully. You should see a lovely $0.99 purchase from me this morning. There was a crash after the purchase, but everything worked as expect with regards to the purchase.

I see no error here.

Rob

Ok, by crash, do you mean there was written that there was written something like “You have already purchased this item”?

So, you did not see a second window behind, as in that screenshot?

By crash I got a popup message saying the app had stopped. In the console log there was a huge stack dump, which I’ve emailed to an engineer to help me understand the cause of it.

At no time did a see a second window under the top purchase window in any attempt to test this.

Edit: Looks like there is a filed bug report for this:  CaseID 46644

Rob

Ok, thank you very much for your help.

Which way of paying did you use?

In fact, I just tried to make a purchase, chose promotion code for the way of paying, entered one and then it said something like “The item has been added”. But then, I get an error saying “Error You already own this item” and after I click “ok” I get “In transactioncallback failed” in the logcat window.

It is the fact that I get this “You already own this item” which made me think that there was a double window opening but, now that you have made this test and told me that there was no error, I was thinking it was in fact normal that the window for the way of paying kept opened…

But, I really cannot understand why it says that I already own this item…

And I am sorry to take your time. Again, thank you very much for your help and support.

Pierre

And, what means the CaseID 46644?

I paid via credit card.

Some items can only be bought once. In Google Terminology these are “Managed Items”. “Unlock the App”, “Buy Levels 10-20”, “Turn off ads” are the type of IAP’s that can only be purchased once.  Unmanaged items: Buy 500 coins. “Buy a health potion” and other types of items can be purchased multiple times, however they have to be "consumed (store.consume() ) before you can buy them again. You decided the type when you create the item in the Google Play IAP dashboard.

Rob