Just quickly... (In-App Purchases - Android)

Hey everyone,

I don't want to take up too much time so I'll keep this short. I just want to know if I'm doing the right thing here in regards to Android In-App Purchases...

My main concern is that I'm not sure whether to add a 'do after' node after a 'consumable' is successfully purchased?

from what I have read in the 'In-App Purchases (Android)', are you supposed to:
- 'buy' a consumable (provided that the IAP is working correctly)
- check whether it was successful
- if so, then do after 2 seconds, 'use' the product and add the items manually?

and if it's purchasing an ad...
- 'buy' the item (provided that the IAP is working correctly)
- check whether it was successful
- if so, then do after 2 seconds, add the items manually?

Also, am I right to assume these 'consumables' (besides the 'purchase_noads') are 'unmanaged', suggesting me to use the 'free unmanaged android purchase with ID:' node at the 'buy' section? Or should I use them at the 'use' section?

Am i Right with this? I have attached the screenshots to show what I have so far.

Cheers,

JBG


Hey guys, would greatly Appreciate the feedback for this.

Cheers,

JBG

squeeb

  • Posts: 1418
hopefully this helps.. i got the in app working.. but was awhile ago.. i just use the same code everytime..
http://community.stencyl.com/index.php/topic,44481.msg250765.html#msg250765

Ahhhh, awesome! I'll try that out when I get home.

Thanks for that Squeeb :)

Appreciate it!

squeeb

  • Posts: 1418
no problem!  let me know if you get it going.. if not.. ill look at my project and get my code

Thank you Squeeb! Appreciate the response :)

I've yet to update it to google play with the latest changes. However, with buying 'ads', you only purchase it once, so is it necessary to add a 'free unmanaged..' block to this as well?

Cheers,

JBG

Hey Squeeb, and anyone else reading  :),

Ok, so I've re-arranged a few things now, and the restore purchases works fine, but I'm still having issues...

just quickly though, I'm still a little hazy with the 'buy/use' block. According to the written material provided in the 'In-App Purchase for Android' page, for unmanaged products, am I supposed to replace 'Buy' product ID with 'Use' instead? Or do I still 'Buy' the product, wait for a response, then when it's successful, then 'use'? If so, will I need to wait again for a response from the 'Use' block? Then, if so, will i need a new 'If purchase successful' event, or will it just reuse the same event?

I'm super confused with this, and I know it's probably not that difficult to grasp, which frustrates me further haha. Sorry.

So here are the images I currently have for my IAP...

I know you have shown me a different way, but that still didn't seem to work :(

My understanding is that the 'free unmanaged' block can technically be anywhere once a product is purchased, because once its purchased, google play just removes it from it's registry afterwards using this block, allowing the player to re-purchase the same item. However, it doesn't seem to recognise this when I apply the 'free unmanaged' block.... Hopefully I'm doing this right, but yeah, again sorry to keep bothering you all like this. Would really appreciate the help.

P.S. i also have a purchase failed/cancelled event as well which are working fine.

Cheers,

JBG

Sorry to keep bugging people with this. Just need this sorted very soon :)

Cheers,

JBG

squeeb

  • Posts: 1418
ill get a screen shot of my code later today when i get off work.
mine is a button to buy more lives for a charge

Thanks man. I also noticed from your other post a while back, you didn't have 'get product quantity for ID: blah' block in your code. Was that intentional? Or is that not a requirement either?

Cheers,

JBG

« Last Edit: November 23, 2016, 03:14:34 pm by JuicyBeetleGames »

squeeb

  • Posts: 1418
heres my code..  its almost a year old.. dunno if anything changed...
its an actor button that when you tap it you are charged and buys more lives
sound is a boolean attribute ..

Mines very similar. However,  the scene doesn't transition into the next scene, mine just purchases and continues on to whatever you were doing in that scene.

I have three purchase events; successful, failed, and canceled.

It seems to be running the failed event every time I purchase an IAP. Which has lead me to believe that the IAP couldn't be used since they have been saved in the google directory. Hence why I thought if I 'free unmanaged' it would work. But again It's not :(

When you first purchase an IAP, it works fine, but when you try to buy it again, it 'fails'.

Here is my updated code:


sorry to keep pestering everyone, but really need this sorted before tomorrow afternoon :S App's going live then.

Cheers,

JBG

riki82

  • *
  • Posts: 325
I have same problem.
First buy of consumable item works fine, but if re-buy this item, the console tell me Purchase Failed.
You have solved?