Download

iOS InAppPurchase

Hello

I’ve been working on my first game in Unreal Engine for the past 2 months, I have no experience in coding so I’m working in Blueprints.

I have reached many obstacles but was always able to find a solution on the forums, on YouTube or within the documentation.

Unfortunately I feel like I got to a point where I’m stuck, so I’m reaching out for help if possible.

I have a store in my game where the player can buy In App Purchases to acquire Coins and Orbs in game. The workflow seemed very easy and straightforward.

I have a Read In App Purchase information node when the player opens the store. This sets the price for each item if successful.


Then I have a Make an In App Purchase when the player clicks the buy button, which if successful, adds the amount of coins to his total coins. And if failed, I just play a Transaction Failed animation.

I added all my IDs correctly and set everything up in the Google Play Store and the App Store.

I tested the game on my Android device and the In App Purchase worked fine.

But when I tested my game on TestFlight, the Read In App Purchase was failing as well as the Make an In App Purchase.
I tried submitting the App for review and got my app rejected because of those errors with the following instructions:

"Next Steps:

When validating receipts on your server, your server needs to be able to handle a production-signed app getting its receipts from Apple’s test environment. The recommended approach is for your production server to always validate receipts against the production App Store first. If validation fails with the error code “Sandbox receipt used in production,” you should validate against the test environment instead."

Now this got me extremely confused as the provided apple documentation mentions receipts with links that I have no idea where to input.
I saw a lot of people saying that i should disable StoreV2, and I did, hoping it would solve it, but I got the same error and reply from Apple’s review.

Then after more online digging, some users were mentioning that these transactions were not safe and were easily hacked, so using a plugin like PlayFab would make it safer. Also PlayFab has a Validate iOS Receipt node which got me thinking that I’m on the right track.

Unfortunately, PlayFab has so little documentation on how to use it with Blueprints and I have literally no idea how to proceed with it.

Can anyone point me on the right track or provide any help if possible?

Thank you

So it turned out disabling StoreV2 in your project folder does not work. I found out that another iOSEngine.ini file exists inside the installation directory and fixing this one got my app working and approved at last.

I really wish Apple didn’t provide this confusing feedback:
“When validating receipts on your server, your server needs to be able to handle a production-signed app getting its receipts from Apple’s test environment. The recommended approach is for your production server to always validate receipts against the production App Store first. If validation fails with the error code “Sandbox receipt used in production,” you should validate against the test environment instead.”

It turned out it’s just a template reply that seemed irrelevant to my problem.

On the other hand, adding Receipt validation with PlayFab seems like an extra layer of security that I don’t know if still necessary, but as I couldn’t find any documentations I just let it go for now.

Hi @i.Kris, you can find the solution for that? Im trying to use blueprint with PlayFab but i cant find any example or tutorial to make the inApp Purchase…

BR

hello guys.ios is different from android.For ios in-app purchases, you first need to submit purchases for approval.

Hello Kris,

Hope you are doing good !

I am also facing similar issue related to In App Purchases, I am trying to submit my App over Store and it has in app purchases. Over Android the app is live and in app purchases are working fine.

But over Apple, I am unable to test, I just followed the documentation required for In app Purchases. and after submitting my App, Apple says.

We found that your in-app purchase products exhibited one or more bugs when reviewed on iPad running iOS 14.7.1 on Wi-Fi.

Specifically, when we tapped on your in-app purchase no further action occurred.

Next Steps

When validating receipts on your server, your server needs to be able to handle a production-signed app getting its receipts from Apple’s test environment. The recommended approach is for your production server to always validate receipts against the production App Store first. If validation fails with the error code “Sandbox receipt used in production,” you should validate against the test environment instead.

Can you guide me, how I can fix this issue.

Looking forward hearing back form your end.

Hi pstakker

Apple’s messages are confusing and misleading so don’t worry about their content, just know that there’s something wrong with your IAP from your side in UE4.

I updated my game to use version 4.26 and used StoreV2 for IAP, you will find below the blueprints I used.


This is the process to load the IAP and display their prices.


This is used to process the payment after purchasing the item.

To know if your IAP are working you can test your app on TestFlight, if they don’t load there means there’s something wrong.

When I said this back then I was using UE4.24, in 4.26 make sure your iOSEngine.ini (in C:\Program Files\Epic Games\UE_4.26\Engine\Config\IOS) has the following lines set correctly:

[OnlineSubsystemIOS.Store]
bSupportsInAppPurchasing=true
bUseStoreV2=true

I’ve done this process many months ago so I might have missed something, but I hope this helps lead you in the right direction.

Good luck.

Also, I wanted to confirm, Do my In app purchases, has to be in Approved State for me to test over Test Flight.

Currently the status of In app purchases are “Waiting for Review”, When I submit the app for review, It status changes to “Pending Developer action”, Then I make any textual changes and its status changes to “Waiting for Review” again.

Can I test the in app purchases over TestFlight with the Waiting for review status or I need to wait for it to get Approved, Will apple approve my In-app purchaes without submitting app?

Looking forward for your help !

Hello Kris,

If I am setting bUseStoreV2=True, my app crashes when I click on In app purchase buy button.
I have attached my crashlog as well.

Also, I wanted to confirm, does the it matter if I write, true or True? I have kept it set to True.

Looking forward hearing back !

crashlog.crash (131.6 KB)

I remember I went through the same dilemma but I don’t fully remember if it worked before they were approved or not, that was more than a year ago.

Try making a dummy project for testing to figure out where the problem lies.

I pasted previously from IOSEngine.ini which was written with lower case true, I don’t have enought technical knowledge to tell you if it matters or not.

What version of Unreal Engine are you using btw? because StoreV2 wasn’t working for me until I upgraded to 4.26. Also make sure you’re using the IAP v2 nodes as shown in the blueprints above. If you’re on an older version then you must disable StoreV2 and use the other IAP nodes.

I am using 4.26 version

Hello Kris,

StoreV2 didn’t worked for me at all, The app crashes whenever i change it to true.

I tried to debug, and when I click on in-app purchase button, it shows “Read InApp Purchase Failed”

Its not able to read the data from in app.

I don’t know what I might be doing wrong.

Hello Kris,

It finally worked, I followed your instructions properly again today, and it all worked fine. There was a issue related to BP node, which was referring to storeV2, I changed that and it started working fine. I kept bUseStoreV2=false only.

Thanks a ton for helping me !