iOS IAP Status?

Greetings -

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?

Thanks
– Steve

2 Likes

Some progress … so after building (or downloading) the plugin, the docs on where to put it are here:

So:

  • Copy the files from the plugin (the .gdif file and the xcframeworks) into ios/plugins
  • Go into the Project Settings in Godot and in the Plugins section, the plugin should be there. Defaults to not enabled for some reason. Enable it.
  • Export for iOS

I do this, and now I have a pile of linker errors (below).

Any suggestions for what to do next? Rebuild the plugin for Godot 4? The last release attached to the godot-ios-plugins repo is from 2022.

Thanks.


Showing All Messages
Ld /Users/stevex/Library/Developer/Xcode/DerivedData/synergy-eufxfvohkdynbydkypzmvrcptchr/Build/Products/Debug-iphoneos/synergy.app/synergy normal (in target 'synergy' from project 'synergy')
    cd /Users/stevex/src/fallday/synergy-ios
...snip...
Undefined symbol: _err_print_error(char const*, char const*, int, char const*, ErrorHandlerType)

Undefined symbol: _err_print_error(char const*, char const*, int, char const*, char const*, ErrorHandlerType)

Undefined symbol: _err_print_index_error(char const*, char const*, int, long long, long long, char const*, char const*, char const*, bool)

Undefined symbol: D_METHOD(char const*)

Undefined symbol: MemoryPool::max_memory

Undefined symbol: MemoryPool::alloc_count
...snip...
Linker command failed with exit code 1 (use -v to see invocation)
1 Like

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.

Will post again when I see the plugin working.

1 Like

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.

Anyway, here are my notes:

Following this guide:

with help from this:
https://www.reddit.com/r/godot/comments/1af8nk1/compiling_on_macos/

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

1 Like

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.

1 Like

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”.

Some people want to make money on games. :man_shrugging:t3:

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.

2 Likes

In this link, there is an extracted_headers folder for version 3.5. I downloaded it.

I entered the terminal codes you gave.

I pasted the created inappstore.debug.xcframework folder with the inappstore.gdip file to the ios/plugins path in my project.

I got the export for iOS from Godot 4.2.2.

Then I opened it in Xcode and when I wanted to get the build for arm64, I got the errors in the image below.

When I send the project to Testflight and open it, the payment screen does not appear, that is, it does not work. There is no reaction.

I created the ios inappstore plugin files for Godot 4.2.2 by following the steps mentioned in the link above.

I pasted the created xcframework folders with the inappstore.gdip file to the ios/plugins path in my project.

The codes are as follows:

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 :

I opened the export project from Xcode, the frameworks settings were as follows :

I added the product id in Apple Developer and it was approved :

But the payment screen does not appear, what did I do wrong or missing?

1 Like

I have the same why still there is not any solution by godot community @stevex @robstar @iscriptz , we are not saw payment screen when click the button

1 Like

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

After adding the bank information, the payment screen opened. Thank you very much my friend for your help :people_hugging:

1 Like

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…