I have a problem with displaying the right price for in-app purchases. Everything works. And the first time if i go to the shop it displays the price. But when i go out of the shop and go back to it, the price changes to null and it stays like that. How can i change this?
When you say you go out and back again, is it a scene change?
Yes change the scene.
So i have a scene for the shop. And go back to the home scene.
OK. Can you try with the example project and check if you notice the same issue?
Yes i have the same problem there. I included a scene change in the example project. So how could i work around that? Because my game has a lot of scene changes.
For the people who read this in the future. I already experimented with variables in this event but on other places. And that didn’t work.
I changed this in the example. And this works.
Could you make a small video showing the issue (with the example project, preferably), that I could forward to the devs? It sounds like a bug.
If you’re looking for a workaround, I would suggest storing the price in a variable once it has been received/registered.
I already got it working, with the above events. And with this i can change the scene and back to the shop and it shows the price correctly.
Sorry for the poor choice of words in the previous post. I changed it.
Ah, okay, great! Thanks for sharing the fix.
This is not the fix.
While the price display correctly with above events. You dont get the stuff you buy.
Does anybody know how to fix this? So how do i save the prices?
I tried variables on multiple places to store the prices. But it just doesn’t work. I have now found an sort of work around. Where i have the above events in the shop. And a extra page to restore the purchases. But after i restored it, and go back to the shop it’s again a null…
Is this a bug? To recreate: if you go to another scene and back to the shop with the example in app purcasche project. All the numbers change from the $$$-price to null.
Here’s my solution:
That scene restarts every game round so I set it to load store data once only (with global Booleans).
I use code from here to check if the string is
As for my checking for
approved state, read this.
UPD: don’t miss this!
Thank you for this answer! I will try this in the weekend.
It doesn’t work. When i first visit the shop page it shows correctly. When i visit the shop again, it wont change to null now. But just had the standard value. ($1,99 which is the value i filled in gdevelop and doesnt come from the store information.)
Did i do something wrong?
Why is it in your events that this is a scene variable and not an global variable?
Global variable :
Function for the null
You asked a good question. I don’t know why it is, but it works (I’ll change that and update the post with results) UPD: I have removed those string is null conditions and everything works fine!
As for your issue. Every time scene is restarted, all objects including price texts are being reset. So you must change them each time a scene is restarted by changing texts to global variables values (with previously saved price and currency).
I have this logic in At the beginning of the scene block:
*I’m sorry I didn’t leave the screenshot in my 1st post.
Thank you very much! This works. You´re a hero! I was stuck on this for a few months.
Can you please make a video. How to add in app purchase. I am also having similar problem with IAP.
I have the same problem too. Thanks for the detailed explanation.
If I understand, the “Store is ready” command only needs to be loaded once, otherwise the “Null” message appears. It’s correct?