Is Game Center login required for using Make an In-App Purchase v2 on iOS?

We are seeing a crash at line 41 in InAppPurchaseCallbackProxy2.cpp because PlayerController->GetLocalPlayer()->GetUniqueNetIdFromCachedControllerId() returns and invalid id.

PurchasingPlayer = (*PlayerController->GetLocalPlayer()->GetUniqueNetIdFromCachedControllerId()).AsShared();

Once I login into Game Center, the NetId becomes valid and I can complete in app purchases. I am able to complete in app purchases on Android without logging into Google Play Games.

Testing on iPhone 8 and iPhone 6s+.
100% repro.

2 Likes

Have you solved it? I am having the same problem.

1 Like

Because of this specification, we are currently unable to introduce in-app purchases due to rejection by Apple’s review.

1 Like

Our solution : In AppStoreConnect, check “Agreements, Tax and Banking” and setup the “Paid Apps” agreement : P

P.S. Sorry for the salty reply a year back…

I’m seeing a similar issue on UE 5.3.1.

Does In-App purchases work for anyone on UE5.3 on iOS? I haven’t been able to get it working due to this error:

UInAppPurchaseCallbackProxy::Trigger - Invalid player UniqueNetId

This is happening because in the InAppPurchaseCheckoutCallbackProxy::TriggerCheckout() function, this line is failing on IsValid() check:

if( FUniqueNetIdRepl PurchasingPlayer = PlayerController->GetLocalPlayer()->GetUniqueNetIdFromCachedControllerId(); PurchasingPlayer.IsValid())

I have confirmed that my Paid App Agreement is valid and active, that doesn’t seem to be the issue.

Not using Game Center and that option is disabled in the certificate.

Everything works fine in a UE 4.27 build so I know the purchases are setup correctly.

@gf11speed, did you find any solution for this? My IAP was also not working on 5.3. After searching, I found that the UniqueNetID is invalid.

f apple, who do they think they are, telling how i can run my company, im gonna show them what REAL developer can do.

Did you ever figure this out? I’m running into the same issue you did.

yeah i did figured it out

do we need source code for mac (for ios build)too?
or only windows?

just for android

In Android crash seems to be fixed now, thanks
But IOS i get IAP failed everytime
any new steps to be followed for ue5.3?

Android: Start in app purchase always fails - #4 by surajreddy here follow this

2026 now and running UE 5.8.0 and still the same issue.

Can’t make a purchase without being logged in to Game Center and yet Apple is rejecting my app because they want Game Center login to be OPTIONAL! Wtf? :man_shrugging:

EDIT:
Okay, so a bit of research later and I have the definitive answer.
Unreal’s internal system for handling in-app purchases ASSUMES you are logged in to GameCenter (on iOS. Other platforms on other platforms) and then makes a hardcoded call to fetch your id. There are ways to try and fake this id so the function returns something valid but I have not been able to get them to work

You basically have three options open to you:

  1. Log in to Game Center, yes. If using the built in stuff you NEED to be logged in to Game Center
  2. Learn the Apple API’s and write your own translate layer to bring those API’s to your code then code in Apple’s APIs directly from within your project. This way you can do in-app purchases while a user is logged into their phone, not their GameCenter. Thus, GameCenter is completely bypassed and not needed. A lot of work, though!
  3. Buy a plugin where someone has already done the work. Simplest way but those plugins don’t come cheap :frowning:

You can just write your own function for it im pretty sure, the make iap node has extra stuff, a simple checkout and query receipts logic using the online subsystem should suffice.

It does require some c++ knowledge but AI can help. Id advise against buying store kit v1 plugins, apple is very likely to deprecate those over the next few years, storekit v2 has been out for a long time but is web api and Swift API only, storekit with objective C, is no longer officially supported.

I already spent days trying to make my own function. I got a plugin on GitHub that does that also. It all works 100% perfectly up to UE 5.7 but in 5.8 (source build) as soon as you add the Foundation or StoreKit libraries from Apple to your project it breaks completely.

Spent days trying to fix it but to no avail. Will have to wait for 5.8 to launch and see if they fixed it so that you can include Apple libra again. Right now as soon as you do it complains that a bunch of UE source files conflict with each other’s definition of Vector. AI suggests I use #undef Vector and a bunch of other tricks but because the file in question does “usiing X as Vector” logic rather than “#DEFINE” logic that undef does nothing.

The only way to get the code with Apple’s libs to build without errors is to make sure you don’t include ANY UE headers in the Obj-C code (oh, and separate your headers into UE and Obj-C files)…. so many things to take note of. Ultimately it can compile but as soon as you try to pass the data you got from your .mm files to a class defined for UE you are back to including UE .h files and then it breaks again.

Trust me, I spent days trying to get this to work. The way that 5.8 handles includes is so strict now that I am not sure it is even going to be possible to include Apple libraries after 5.7. Unless they change it a LOT I don’t see how it can work any more. So I reached out to the guy who got an Epic MegaGrant to write his plugin and now sells it for $100 on Fab. I asked him if he has tested that his kit works in 5.8 and he said “No. I will test and update after 5.8 is released in the Launcher”. So up until then I have no idea if Apple libraries can still be used after 5.7. Will have to wait and see.

hmm You may be able to build a Swift language bridge but you would have to look more into how that would work, store kit in swift is super easy from what I understand. I am not entirely sure why you are trying to overwrite the unreal apple SDK though, you should just be able to use the Online Subsystem or Online Services plugins, but if all else fails you can just buy a plugin from fab which may be cheaper long term than trying to fight the engine.

I am not trying to overrite anything. I am trying to do the absolute minimal effort but:

Unreal ASSSUMES you are logged into something based on the platform you are compiling for and thus your UniquePlayerID willl be set. In the case of iOS, that is not true. You have to first log into GameCenter before that Unique Id is set. If you do NOT log into GameCenter and you look at the output logs in Xcode the errors say “Net Id was invalid. Request was not even sent”. I love how they add the word “even” in that log. “You didn’t provide a unique Id, so this code won’t even run. We won’t even TRY to contact Apple to get your products. Log in to GameCenter first then come see me when you are done”. That is the response from Unreal.

So I implemented GameCenter login and after that all the built in functions worked as expected and all was well with the world. Then I submitted my update to Apple and they rejected it saying “Login to GameCenter should be OPTIONAL. We will NEVER accept your game as long as you force people to log into GameCenter”

So now what? Unreal FORCES you to do it and Apple flat out rejects your app IF you do it.

The only option is to write your own version of that 2 simple functions: GetPurchasedItems and MakePurchase…. those two functions are all I need. How hard can it be to write 2 functions? Well, as soon as you import any of the core Apple libraries Unreal complains about confilicts within itself. Please take special care to read that line very carefully: Unreal doesn’t complain about the code YOU write, it complains about it’s own internal code conflicting with itself in other of it’s internal code.

So that “absolute minimal effort” now involves rewriting Unreal itself. Yeah, I don’t have the skills to rewrite the core of Unreal Engine. And this is where the problem comes in. Once this new version of Unreal goes live, will this problem persist or not? If not, then how in the world did they fix it? Honestly, i don’t care about the how, I just want it to work again like it does for every other version of Unreal up to 5.7

From what I understand, what happened in 5.8 is that Epic now implements a strict “only include what you use” policy and many of those precompiled headers that include so many things for you, yeah, they are gone now. Many of the things that “just worked” in the past now requires extra headers to be included. I don’t know how to explain it… they just got a lot more strict with what gets included and in what order. Now, they declare a struct in one place and declare it again in another place and they do it in such a way that it works. Now, as soon as you add any Apple code into the mix and Apple also defines the same struct then Unreal sees APPLE’s struct FIRST and then complains about it’s own structs when it tries to define them. Problem.

Epic is well aware of this issue and actually includes headers that you call directly BEFORE including Apple headers and one to call directly AFTER including Apple headers. The ApplePreHeaders.h (or whatever it’s called) undefines all Unreal’s types and the ApplePostHeaders.h redeclares them when it’s all done. This was supposed to solve this problem and probably did in earlier versions of Unreal but not any more.

EDIT:
See this post also Impossible to add Apple StoreKit to a UE 5.8 project

Okay, thank you for explaining it to me in more detail, and it does sound frustrating what you have been experiencing.

I did take a quick glance at the post you linked for context, and I can’t speak for that plugin maker but you do have the option of making a direct store kit api(unreal bundles this) and c++ bridge, using a .mm file, C code, and c++ for calling it and importing the .mm file. Unreal does bundle the raw store kit file, but to use it outside their abstraction layer(bypassing netid) you just need a bridge. ChatGPT or Gemini should be able to help if you ask for this:

“Help me build a bridge between the direct store kit api unreal ships with in a .mm file you help me make, a game instance subsystem that calls it in c++ as a blueprint callable function, and any setup required to get this working with packaging, go step by step and don’t jump ahead or rearchitect”

The only thing is, you would need to move on from a third party plugin idea as they did not use this method. Unreals packaging system will argue with you if it detects and duplicates, with include what you use this becomes more common in older code bases and you may need to wait before upgrading to 5.8 for the devs to figure out what they should import and what should be removed.

The online subsystem isn’t really an api for platforms, it’s a unified high level abstraction data transfer class for service backends, sometimes this means APIs that should be easy are not and it may not include all APIs the engine ships with or even be usable outside specific contexts like Game Center being required, my guess is Game Center is where achievements and multiplayer exist on iOS so epic probably just made that the intended design pattern even if it breaks other features and Apple doesn’t allow it. I would not expect epic to change this as I’m not sure they can, given what the online subsystems are and their dependence on Apple here, but I do agree they should remove the or put a warning in the in app purchase functions so people are aware that’s not a passive aggressive log statement.

Another day wasted on this :frowning: At least I got to the point again where the Vector issue is resolved but then got stuck again at the point where compilation fails because UBT can’t find the StoreKit library no matter what method I use to link to it. Compilation keeps failing with unknown symbols.

Ughgh. I give up. I’ll wait for someone more clever than I to fix this :frowning: