Problem with In-App Purchase

Someone for the love of god please help me out with the In-App Purchase feature for IOS, everything that i do don’t work it won’t execute, always fail.

I have the feeling that i’m missing something because it won’t open the option to purchase the item on my device it only print out ‘‘fail’’, I read that you have to add a code on Build.cs file but which one ? enginebuild.cs ? defaultenginebuild.cs ? on match 3 IAP document it says that if is base on blueprint i’m good to go on other thread i read that you have to implement the code, also in the engineios.ini i change ‘’ SupportInAppPurchasing ‘’ to True but still nothing, also i have the Product Identifier the same as the Product ID in itunes connect do i need to add a link ? Do i have to submit the app to test it ?

Please help it very frustrating to see that one of the most important feature in the engine unreal still don’t have a proper tutorial and a outdated documentation on this important subject.

I’m seeing this issue on Android as well. (4.11 however)

in Engine\Source\Programs\UnrealBuildTool\Android\UEDeployAndroid.cs the following ALWAYS returns ‘false’ even if bSupportsInAppPurchasing is set to true in the config. (DefaultEngine.ini or AndroidEngine.ini):

Ini.GetBool("OnlineSubsystemGooglePlay.Store", "bSupportsInAppPurchasing", out bEnableIAP);

As a work-around I’ve moved the flag to the AndroidRuntimeSettings which works by changing it to the following:

Ini.GetBool("/Script/AndroidRuntimeSettings.AndroidRuntimeSettings", "bSupportsInAppPurchasing", out bEnableIAP);

It’s possible the same is happening on iOS. As a test try changing
Engine\Source\Runtime\Online\IOS\OnlineSubsystemIOS\Private\OnlineSubsystemIOS.cpp

And replace:

GConfig->GetBool(TEXT("OnlineSubsystemIOS.Store"), TEXT("bSupportsInAppPurchasing"), bEnableIAP, GEngineIni);

With:

GConfig->GetBool(TEXT("/Script/IOSRuntimeSettings.IOSRuntimeSettings"), TEXT("bSupportsInAppPurchasing"), bEnableIAP, GEngineIni);

If this works, then someone has broken non-class derived config values across the board, and this is an engine bug.

Hopefully this helps. :slight_smile:

Hey thank for the reply

I tried what you suggest but unfortunately it did not work i also saw that ‘’ bEnableIAP ‘’ was false and change it to true but did not work as well.

No, i din’t change or added anything to the DefaultEngine.ini , Should i change or add the code you provided above ?

97141-screenshot+(74).png

Just a quick follow-up, you did change the following in the DefaultEngine.ini config from:

[OnlineSubsystemIOS.Store]
bSupportsInAppPurchasing=True

To:

[/Script/IOSRuntimeSettings.IOSRuntimeSettings]
; All other ios settings here..
bSupportsInAppPurchasing=True

As well correct?
(i.e. Moving which section it’s under)

EDIT: changing the “bEnableIAP” won’t actually do anything as it’s just a local variable used to spit out the value from the config.

Yes. If you don’t it won’t be able to find the value as it’s not in the right place.

(Also make sure you’ve re-built the IPA on the mac as the Engine\Source\Runtime\Online\IOS\OnlineSubsystemIOS\Private\OnlineSubsystemIOS.cpp change is a CodeFix)

So i change the code and this is my new setting in OnlineSubsystemIOS.cpp and DefaultEngine.ini

97152-screenshot+(75).png

97153-screenshot+(76).png

But unfortunately it din’t work ¿Did i put something wrong ?

That’s all correct.

As long as you’ve rebuilt the iOS binary that should be fine.

As an extra test, you can add a logging statement to the function to make sure that’s all working. Like so:

bool FOnlineSubsystemIOS::IsInAppPurchasingEnabled()
{
	bool bEnableIAP = false;
	GConfig->GetBool(TEXT("/Script/IOSRuntimeSettings.IOSRuntimeSettings"), TEXT("bSupportsInAppPurchasing"), bEnableIAP, GEngineIni);
	UE_LOG(LogTemp, Log, TEXT("FOnlineSubsystemIOS::IsInAppPurchasingEnabled: %s"), bEnableIAP ? TEXT("True") : TEXT("False"));
	return bEnableIAP;
}

Then when the app is starting up, it should spit out “FOnlineSubsystemIOS::IsInAppPurchasingEnabled: True” If that is all working correctly.

If it does, then It’s a totally different issue and I have no idea what it is.

If it doesn’t spit this out anywhere, you haven’t compiled the code correctly.

Okay after a couple days of research i think i know what going on, so the way i’m testing the In-App Purchase feature is by packaging my project through the engine and then installing the app through itunes, i’m doing all of this in a PC not in a MAC, so after researching a bit i think i need open and build the app through xcode, is it true ? if so how do i do this ? i upload the app (IPA) in xcode but doesn’t give me any option to build.

Sorry if it sound a noob question, i’m not familiar with xcode.

As long as you have rsync set up for building iOS from PC to Mac, you should not be running into any trouble as long as your in-app purchase is set up correctly within your project.

To compile the project:

The Unreal Engine Xcode project is configured to build Debug configuration when you use Xcode’s Product > Build option and Development configuration when you use Product > Build For > Profiling. You can edit this behavior by editing the target schemes.

[Compiling Projects Documentation][1]

Compiling Game Projects in Unreal Engine Using C++ | Unreal Engine 5.1 Documentation

Hey

Do i really need XCODE to test In-App Purchase on my iphone ?

Here is everything that you need to know about creating iOS code projets: [Building iOS][1]

You can use Visual Studio or XCode. You need to make sure that if you’re using Visual Studio on a Windows machine, that you’ve set your Source build up correctly for packaging iOS projects.

Thank you!

A new, community-hosted Unreal Engine Wiki - Announcements - Epic Developer Community Forums

Sorry for not replying in regard of this issue, I wanted to finish my game before attacking this issue.

I still haven’t resolved this issue, i can’t get IAP to work no matter what i do it won’t work.

To recap, the way I’m testing it is like this :

  • Packaging the game through Windows
  • Installing the app through Itunes
  • Ether I’m sign in/out in my iphone it still fail

It like it won’t connect online doesn’t open appstore or the option to sign in.

I read everything in this post to see if i miss something but everything is what it suppose to be, i also read another person having this issue but I already did what they did to resolve the issue.

Is there a specific provision or certificate i need to have ? Maybe i pick the wrong one

Is there another engine file i need to edit ?

Did i miss something in the blueprint ? Maybe I left out a code

Please help im desperate and frustrated.

Did you look through [this information][1] to make sure you could properly implement IAP for iOS?

Make sure that your provisions/certifications are updated correctly for distribution and purchases.

[Using IAP on iOS][2]

Technical Note TN2259: Adding In-App Purchase to Your Applications
[2]: Using In-App Purchases in Unreal Engine Projects for Mobile Devices | Unreal Engine 5.1 Documentation

sorry for not responding but i having trouble with the distribution provision and certificate, they’re valid with check mark but not green, they’re white, i’m using the same bundle ID. However i can still manage to package the game but it give me error related to the certificate and provision. I still package the game tried the IAP but it still won’t work.

Do you want me to send you a screen shot of my setting or something ?

i follow the instruction above and everything is in order.

Juan,

Since this issue is different than what you were originally having, could you please post a new question and we’ll have someone look into it. Include screenshots, logs if necessary, etc.

Thanks!

Despite the provision and certificate error, i can still package the game, i also uploaded to itunes connect without any problem but still gave me the same result, IAP wont execute, nothing happen, always fail.

Here’s a side note it (may have something to do with IAP) i added a ‘’ Show External Login UI ‘’ node to my level blueprint and now i can connect to game center however only without internet connecting. Either way with or without internet connecting IAP wont execute.

No matter what i do, what setting i tweak nothing work:

  • (IOSEngine.ini & DefaultEngine.ini) and also (OnlineSubsystemIOS.cpp)
  • Distribution or Development with/without Shipping
  • Develorper Cert and Prov are Green
  • Distribribution Cert and Prov are white but Valid
  • Updating Engine
  • Test it through ITunes Connect
  • Sign in or out in my IPhone
  • Uploading it through ITunes

None work, no option for logging in, no crash, NADA.

Edit: FINALLY!!! this issue have been SOLVED!!! in IOSEngine.ini

[OnlineSubsystemIOS.Store]
bSupportInAppPurchasing=True

Was misspell/Typo, in Supports the S was missing in the end, it should be:

[OnlineSubsystemIOS.Store]
bSupportsInAppPurchasing=True

Credit to this post:

I’m so glad that you were able to resolve the issue, thank you for posting what the resolution was.

Let us know if you need any additional assistance! :slight_smile:

Thanks for the assistance, I have another issue and i was hoping you can help ?

The IAP work, however the Restore node don’t work every time, when i manage to successfully restore the item, i relaunch the app to try it again, but it ask me to purchase the item again and when i do it say i already buy the item.

is this how sandbox work ? or is this a bug ?

I write it here since is related to IAP but i create another thread since is another issue.

Hi I’ve had the same problem for IAP hope you can help me. The iOSEngine.ini is with “s” in mine behind the support but my IAP just don’t work… do you mind to share your workflow? And as well do you build with shipping or development package? And is it compulsory to upload to iTunes connect to test or I can install the IPA through iphone packager?