iOS in app purchases issues


  • *
  • Posts: 3
Hello, I'm currently developing an iOS game, and I need some help with making an in-app purchase work. I followed this guide as best as I could, but it seems very outdated and perhaps outright inaccurate at some points.

So here is what I need to happen; I have a single, non-consumable IAP in my game, that, after purchase, allows the player permanent  access to additional levels in the game. I currently have my game set up so that if you press the button on the main menu that takes you to the additional levels menu without having bought them yet, it will instead take you to the purchase screen, where you can view information about the additional levels, and press a "yes" button to initiate the purchase. After purchase is successful, a boolean called "bought" is set to switch from false to true, thus letting players access the additional levels by pressing the button again on the main menu. Additionally, you are sent back to the main menu after a successful purchase.

So here is what actually happens so far: On the main menu, I press the addition levels button, which takes me to the purchase screen. I press the "yes" button, and am immediately taken back to the main menu, something that should only happen if the purchase was successful. So I press the additional levels button again, thinking that it will now take me to the additional levels menu, since the "bought" boolean should now be set to true, but it instead takes me again to the purchase screen.

No matter how many times I press "yes" I am simply taken back to the main menu without the boolean changing, which makes no sense, because if the purchase was not successful, I should not be taken back to the main menu, and if it was successful, the boolean should also have changed. The boolean change block and the switch scene block are one on top of the other inside the block that activates when the purchase is successful, so it should be impossible for only one of the events to occur.

Things possibly of note:
-I am testing my game on an iPhone 8 (updated to iOS 15.6.1, which is the latest update available.)
-I definitely have my IAP ID correct in all blocks, I've triple checked
-I am using that outdated guide, since I cannot find a more up-to-date one
-I've included my code blocks in screen shots for reference

Thanks for any help!


  • *
  • Posts: 4666
Is that the only place in the game where you set Bought to true or false? Are you using save/load game blocks (which could load the old value of Bought)? Alternatively, are you even sure that Bought is being set to true in the first place? You don't have any other code in your game that could be switching you back to the main screen? You may want to insert print blocks into your game and watch the logs to make sure that what you think is happening is actually happening. You can also print the value of the Bought attribute at key points.

It may be simpler to use the purchased product with id block for this.
For Live Support: Join our discord server and ping me @justin.
I'm most often available between 10am and 10pm Japan time. (GMT+9)