I’m wondering what the status is of IOS IAP support.
I’ve tried to use the official inappstore plugin (GitHub - godotengine/godot-ios-plugins) … I got it to build, but the instructions stop at what to do from there.
I’ve looked through Google results, forum posts, and it seems like this is a part of Godot that isn’t getting a lot of love.
But … isn’t this one of the top targets for game development? Are people really not using Godot to build commercial iOS apps?
Anyone have any recent experience with adding IAP to an iOS app they can share? A tutorial that worked?
This is because the plugins needed to be recompiled. I built the plugins following the instructions and replaced the binaries with what I built, and no more link errors. I haven’t tested the plugin functionality yet but seems like progress.
I just went through this earlier this week and made myself some notes as I followed the guide, I’ll post it below. I’ve managed to be able to get ahold of the plugin within my code using _appstore = Engine.get_singleton('InAppStore')
But I’ve been unsuccessful at making a purchase, when I attempt to call var result = _appstore.request_product_info( { "product_ids": ["bundle_01"] } )
it comes back with ‘31’ and ‘invalid_product_ids’:[“bundle_01”]’
I don’t know if this is some kind of issue with how I set up my IAP within iTunesConnect, or an issue with a provisioning profile, or something else. I’ve spent the last 3 days working on this and haven’t made any progress. If anyone has any suggestions I would love to hear them. This was honestly my biggest concern about using Godot, I had hoped that these integrations would be further along than they appear to be. I started my project about a year ago hoping mobile support would catch up.
at Step 4 to use this command:
scons target=editor arch=arm64 simulator=no plugin=inappstore version=4.2.2
download the “all” tar file
then use this command (with appropriate path to ios sdk):
scons target=editor arch=arm64 simulator=no plugin=inappstore version=4.2.2 vulkan_sdk_path=‘/Users/robbyc/Downloads/MoltenVK/MoltenVK/MoltenVK.xcframework/macos-arm64_x86_64’
Step 6
cd godot
scons target=template_debug arch=arm64 simulator=no plugin=inappstore version=4.2.2 vulkan_sdk_path=‘/Users/robbyc/Downloads/MoltenVK/MoltenVK/MoltenVK.xcframework/macos-arm64_x86_64’
cd …
./scripts/generate_static_library.sh inappstore release_debug 4.0
./scripts/generate_xcframework.sh inappstore release_debug 4.0
cd godot
scons target=template_release arch=arm64 simulator=no plugin=inappstore version=4.2.2 vulkan_sdk_path=‘/Users/robbyc/Downloads/MoltenVK/MoltenVK/MoltenVK.xcframework/macos-arm64_x86_64’
cd …
./scripts/generate_static_library.sh inappstore release 4.0
./scripts/generate_xcframework.sh inappstore release 4.0
Ok I ended up getting my test purchases working through TestFlight. I kept getting “invalid_product_ids” and I finally discovered that this was due to my developer account not having a tax id. I had already configured a bank account and all the other agreements were signed but I guess everything needs to be completed in order to get transactions to go through. It took about an hour after I submitted the last detail before transactions started working.
Also, I have my IAPs configured in App Store Connect but not submitted, their state is “Ready to Submit”. Hopefully following that guide to compile your own plugins helps you get to a state where things start working.
Don’t use the iOS Plugin provided by Godot. It’s been announced and marked as deprecated since WWDC '24. It’s based on Storekit 1 which has been around since 2009.
I keep discussing this with developers and trying to raise awareness on this very blatant opinion by FOSS developers of “ew money in video games is bad”.
I did get this working, a while ago, sorry I forgot to update this thread.
I mostly used the code from this issue:
I did have to build the plugin myself, I believe this was the process:
# Building the official Godot iOS plugin for Godot 4
cd ~/src/github
git clone https://github.com/godotengine/godot-ios-plugins.git
cd godot-ios-plugins
rm -rf godot
cp -R ~/Downloads/extracted_headers/godot godot
# Edit the SConfig file and update platform/ios to platform/iphone
./scripts/generate_xcframework.sh inappstore debug 4.0
The extracted_headers folder comes from the Godot releases GitHub page.
extends Node
var in_app_store
signal bought_product(product_id: String)
var my_product_id = "bundle_seven"
func _ready():
if Engine.has_singleton("InAppStore"):
in_app_store = Engine.get_singleton("InAppStore")
else:
print("iOS IAP plugin is not available on this platform.")
func _on_button_pressed():
if OS.get_name() == "iOS":
on_purchase_pressed(my_product_id)
await get_tree().create_timer(1.0).timeout
check_events()
func on_purchase_pressed(product_id: String):
in_app_store.set_auto_finish_transaction(true)
var result = in_app_store.purchase({ "product_id": product_id })
if result == OK:
print("busy ...")
#animation.play("busy") # show the "waiting for response" animation
else:
print("error.")
#show_error()
# put this on a 1 second timer or something
func check_events():
while in_app_store.get_pending_event_count() > 0:
var event = in_app_store.pop_pending_event()
if event.type == "purchase":
if event.result == "ok":
emit_signal("bought_product", event.product_id)
print(event.product_id + " purchase successful!")
#show_success(event.product_id)
else:
print(event.product_id + " purchase failed.")
#show_error()
I got export for iOS from Godot 4.2.2. Export settings are as follows :
Try printing out some messages so we can see what type of error you are getting.
Also, have you entered in tax info including SSN or EIN on apple’s website? I couldn’t get anything to work until I did that
Now any payment screen open in ur application when you using this plugin, apple accept our game, but in app purchase payment screen mot open when click the button unfortunately
Hi! I first tried to compile libraries from official repo and failed.
Then I stumbled upon a video - how to bridge into Obj-c and potentially into Swift (for those who want or will have to use custom solution, or use some lib for iOS)
Finally I’ve written a gist based on contents of video, hope this will help somebody.
I’ll try to build iap prepared library from repo later…