How do I Make In-app purchases correctly?

Get help using Construct 2

Post » Sun May 17, 2015 3:06 pm

hey guys so i've published my game and when i press the button to buy an item it gives the PURCHASE FAILED message for the first try, on the second button press it works. This happens to all my in-app products!

First press nothing, second button press works

here is my code:

On btn press: fetch product "name"
is in cocoonJS
is store available then: purchase product "name" with preview


Anything wrong with this? I dont want to have the user to press 2 times for 1 purchase!
B
5
Posts: 48
Reputation: 319

Post » Sun May 17, 2015 3:46 pm

Just to be more clear:
The problem happens on each purchase i try to make for the first time but disappears on second try

If you want a visual example go to the play store and download The Game Of Boz and see for yourself, so far i've had no luck in fixing this issue.. if you guys know what i could do then please help ;)
B
5
Posts: 48
Reputation: 319

Post » Sun May 17, 2015 3:52 pm

If I understand correctly you are trying to fetch and buy in the same event..
There is a big chance fetch works like .get and it's results will only be available the next tick..
That sounds like a reason why the second time it is working..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Sun May 17, 2015 4:26 pm

So what should i do to fix this, could you please explain more about this "next tick" ?
B
5
Posts: 48
Reputation: 319

Post » Sun May 17, 2015 5:14 pm

BUMP would like to solve this as soon as possible so i can finally publish the whole thing (can't wait!!!)


what i tried to do just now was adding a WAIT after the fetch but nothing changed :/ How do i make this "next tick" work @Littlestain
B
5
Posts: 48
Reputation: 319

Post » Sun May 17, 2015 5:25 pm

I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Sun May 17, 2015 5:56 pm

@littlestain

Thats the tutorial i followed in the first place! The only difference is that instead of fetching the product on start of layout im fetching it on button press because there is more than 1 product to fetch!


So, taking for example the pic you posted its:
ON TOUCH SPRITE: fetch "firstproduct"
is in cocoonJS
is store available : then : purchase product "firstproduct"


Any workaround to this?
B
5
Posts: 48
Reputation: 319

Post » Sun May 17, 2015 6:32 pm

From another topic:

2) Fetching can be done at any point in time before the user could buy. For example: On start of layout, or even "On Purchase button pressed". But in this case, you should also use "is Fetched" then Purchase.
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Sun May 17, 2015 6:40 pm

is "is fetched" the same as "is store available" or "is in cocoonJS"? Because i dont see any other options such as "Is fetched" There is, however, these two:
"on product fetch completed"
and
"on product fetch started"

Are these the same as "is fetched"?

Sorry for all these noob questions @littlestain and thanks for the help so far!
B
5
Posts: 48
Reputation: 319

Post » Sun May 17, 2015 7:19 pm

I can only guess, not having worked with this before, but "on product fetch completed" sounds right..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Next

Return to How do I....?

Who is online

Users browsing this forum: corporatedrone and 24 guests