How to deal with in app purchases?

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

You filed a bug report. Each bug report as a unique ID that we call “CaseID”. The ID of your bug report is 46644. You should have gotten an email that confirmed the bug submission and that Number was in the subject of that email.

We usually ask bug fillers to post the CaseID number to the forum thread so later when you ask “Hey Rob’s what’s going on with this”, I can then go look up the bug.

Rob

Ok, thanks for your reply.

But I really don’t understand why it would print that it had already been purchased although it was the first time I did so…

You may have purchased it in the past.

Ok, thanks for the explanation.

Pierre

Then, shall I create a new item to purchase?

And, I just have a last question. You said that I should see a lovely $0.99 purchase from you this morning. But I cannot see it… Where shall I see this kind of information?

I wouldn’t create a new test item. Most people create new test accounts.

You will have to use Google and search for tutorials on how to use Google Play’s developer interface. Look around for reports. It may take a day for it to show up. And it won’t likely show as from me. It may be in Google Wallet or wherever your reports are.

Rob

I created a new test account but again, it said that I had already purchased the item. And, previously, I had also reseted the phone to make sure that the last email adress would not be present in the phone anymore.

In fact, it only worked when I went to settings, account details and added the test email adress… But then, the app crashed and I don’t know why…

Pierre

The crash sounds like it’s a problem with your setup and most likely your licensing key not being correct. You might want to double check it. And yes, you will have to have your device logged into your test account to do the purchase. And you will have to do this each time. But while you’re testing, you’re not supposed to be using your live products. Google gives specific testing products: one that will succeed, one that will fail etc.

See: https://developer.android.com/google/play/billing/billing_testing.html

Scroll down to where it reads “There are four reserved product IDs for testing” to get the test products you should be using.

Rob

Ok, thanks for your reply.

I saw an “invalid public key” in the console output. Does that mean the licensing key is not correct. And, in the licensing key provided by google in the console, there were lots of “+” or “/”, do I have to remove them?

Pierre

I’ve not touched the Google IAP portal in months. I would search google, find the IAP setup documents or find a tutorial on setting up IAP for Google and make sure you’ve done everything correctly.

Rob