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!
`