iOS in-app purchase, Godot 4.4

Godot Version

4.4

Question

`I wanted to share my experience with the godot-ios-plugins, specifically the inapppurchase plugin, in relation to Godot 4.4, which unfortunately still relies on StoreKit 1.

Even after compiling the plugin properly against the 4.4 Godot branch and getting it to work, you might find it frustrating that it behaves inconsistently when validating past purchases. Worse, it’s impossible to retrieve the current status of a subscription—which was exactly my issue. For consumable purchases, this isn’t a major problem since the only important flag is whether the item has been purchased. The good news is that the PURCHASE event is consistently emitted, allowing you to grab the transaction ID from the payload.

However, validating a subscription is another story. To work around this limitation, I developed a reliable solution—as long as the PURCHASE event continues to be consistently emitted (at least until Apple deprecates StoreKit 1 for good).

Many developers new to iOS game and app development might not realize that Apple provides a Store Server API, which allows you to retrieve purchase information using—drumroll—transaction IDs.

With that in mind, the only thing you need to do is store the transaction ID in a database upon purchase. As a backup, I also save it to the filesystem in case the database insertion fails. This ensures that the transaction ID can be passed along whenever the user logs in.

Once the transaction ID is stored, your server can connect to the Apple Store Server API to retrieve its status. The API response contains plenty of useful data, so you’ll find everything you need to validate a purchase.

If you’re using Node.js with Express, you can leverage a package like app-store-server-api. If you prefer a PHP backend, you can use readdle/app-store-server-api.

After retrieving the purchase status, simply return it to the app after each successful login—problem solved! :slightly_smiling_face:

`

Is the documentation working for compiling the plugin? I had it working in 4.1 and then tried with 4.2 and kept getting errors about the location of some molten sdk or something so I gave up. I wish they would make this a smoother process for mobile development. IAP and apple login and Facebook login are what keeps me from fully committing to Godot as a mobile developer.

Hi @robstar , I completely agree, the documentation is not straightforward when it comes to compile the the plugin.

I also bumped into the same issue with MoltenVK when trying to compile. I found out in the end that in the Godot submodule directory (branch 4.4) there is this file => godot/misc/scripts/install_vulkan_sdk_macos.sh, this is the file that should be used to install MoltenVK properly.

Do you have a walkthrough you used to compile the plugin? I’m trying to find the one I used a year ago and haven’t been able to locate it.

I found this guide that still works but I went up to Godot 4.4.1
One thing I found was that one of the shell scripts was no longer provided with the plugin repository so I copied one from the 4.3 branch and it worked, although I do get an error about one of the architectures not being able to compile, which chatGpt tells me is because it’s for the deprecated 32-bit iOS build so I can ignore it. Still confusing, but I was able to get it working. Also your tip about installing the MoltenVK via the install script was very helpful.

I’m having the same issue with the shell script no longer being available. Could you point me to where you were able to find the missing file? I see there’s a 3.3 branch, but I don’t see the 4.3 branch.

After looking at the commit where that file was removed, it references that it was removed because of duplicated code. Makes me think that the file is no longer needed and that you only need to run the one remaining shell script (generate_xcframework.sh). I found a link to the deleted one on GitHub though but I would try skipping it first