iOS In-App-Purchases problem

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By TobiLa

Hi, I am trying to get In-App-Purchases working with Godot on iOS since almost a week now based on this doc:

https://docs.godotengine.org/en/3.1/tutorials/platform/services_for_ios.html

I created an entry for the App in Appstore Connect, created an App-ID and an In-App-Purchase. The In-App-Purchase has the state “ready to submit”.

So far everything is working, I have no issues installing the app on devices whatsoever, so I guess the basic licensing is configured correctly. The app was successfully tested with internal testers and external testers on TestFlight. However in app purchases aren’t working at all.

When I am calling

request_product_info

with either

com.mycompany.myapp.mypurchase

or just

mypurchase

(don’t know which is correct, the doc isn’t clear about that) I get the following response

{ “type”: “product_info”, “result”: “ok”, “invalid_ids”: [
mypurchase, com.mycompany.myapp.mypurchase ], “ids”: [ ], “titles”: [
], “descriptions”: [ ] , “prices”: [ ], “localized_prices”: [ ], }

When I am calling

purchase

the call itself is returned with an OK.
After a few seconds I receive the following event:

{ “type”: “purchase”, “result”: “error”, “product_id”: “mypurchase”,
“error”: “Cannot connect to iTunes Store”}

Please is there anyone here who can help me? I am slowly going mad, I worked on this for more than 30 hours now and I am really running out of ideas.

Thanks for any hints,
Tobias

Were you able to figure this issue out?

I am experiencing the exact same problem you are.

I tried following a bunch of potential solution to no avail…

Richard van der Dys | 2020-06-26 17:40

I have the same problem too… “cannot connect to itunes store”.
I tried everything. Did you solve it?

aleks | 2020-08-07 05:34

Hello Tobi, could you point us to the right direction if you have solved this?

aleks | 2020-08-07 05:35

It was just a missing contract my boss had to accept. Don’t know any more details than that, I’m sorry :confused:

TobiLa | 2020-08-08 15:34

:bust_in_silhouette: Reply From: TRG

Hi Tobias. Did you find a solution yet?
Looking to switch game engine from Unity and would not do the switch if IAP is not working for iOS

:bust_in_silhouette: Reply From: Vaughan Ling

Here is my working IAP script, hope this helps
https://www.dropbox.com/s/ka82wus7cti05tc/iap.gd?dl=0

:bust_in_silhouette: Reply From: azwethinkweiz

Hey,

I got this to work.

have you set up your app’s IAPs on App store connect?

If so, it is the “PRODUCT ID” string that you set up in there.

It will be something like au.org.xxxx.xxx and in your game you call:

	IAP = Engine.get_singleton("InAppStore")
	var event = IAP.request_product_info( { "product_ids": ["au.org.xxxx.xxxx", "au.com.xxxx.xxxx"] } )
:bust_in_silhouette: Reply From: TobiLa

It was just a missing contract my boss had to accept. Don’t know any more details than that, I’m sorry :confused:

Thank you! I solved this, it’s because I had to set up banking in App Store Connect, otherwise Apple would not allow the connection. Your code is actually perfect.
Bascially Apple doesn’t really allow IAPs to be tested if banking is not set up (but it’s not clear from the documentation, should be added in Godot docs as well!)

aleks | 2020-08-09 00:06

:bust_in_silhouette: Reply From: aleks

Solved this after 3 days of trial and error.

The code posted above is perfect.
The problem was that App Store Connect was not set up correctly from Apple’s side. Look in the comments for more info.
Being not fully set up, Apple would not enable the IAP’s, thus sending the message “cannot connect to iTunes Store”.

I had the same issue, should be added to Godot Docs for clarity.
Remember: even just to test IAPs, you need to have a dev account with Apple with banking set up, and enable that in-app purchase.