cancel
Showing results for 
Search instead for 
Did you mean: 

How to make the IAP (In-App Purchase) to work with Unreal Engine?

davidchen127
Explorer
Dear all, 
I'm trying to implement the IAP for Oculus Go/Quest with Unreal Engine (4.23.1). I've followed the documentation and set up the environment (the plugin is added in Build.cs and the "OnlineSubsystemOculus" plugin is enable in Unreal) and include the "OVR_Platform.h" in my code. The IAP items were also given on the developer dashboard. But still I can't get any of those APIs to work, such as ovr_IAP_GetProductsBySKU. Can someone share experience about the right procedure or steps for implementing IAP with UE4?
p.s. I also checked the unreal sample project provided by Oculus in that Platform SDK v17. But in that project, it doesn't use the OSSOculus APIs but just the Unreal built-in Online APIs.
Thank you in advance for any help.
18 REPLIES 18

davidchen127
Explorer
Hi @en-austin,
My target platform is Oculus Go, and I can only test it by uploading to the store and then download it from my Go. Otherwise the entitlement check will fail. I've also checked many times of the code logic and couldn't think of anything. Maybe I should try the Android Studio for debugging.
Thanks a lot for your advice.

en-austin
Protege
Good luck @davidchen127 - sounds like it's close if you got the Oculus purchase UI to pop up once. If you get a good log file and you like another pair of eyes on it, feel free to post it and I'll take a peek.

davidchen127
Explorer
Hi @en-austin,
I used the Android device monitor to log when I triggered the crash. Here is the Assert level of log and I don't know maybe you can help me find some clues what exactly led to the crash. I've attached it as text file in the attachment.
Thank you in advance.

davidchen127
Explorer
Hi @en-austin,
I think I successfully did the checkout of IAP. It was the part I used a string instead of a const char* as the argument for the checkout function. But it works now. 
However, I can't consume this purchased consumable item because after I jumped to that Oculus purchase screen, my app already stopped. So I suppose the function to consume the item can't be reached.
Have you encountered similar problem before?

en-austin
Protege
Hi @davidchen127 ,

Great to hear about the progress! Even though the Quest suspends your app to display the Oculus purchase UI, it should resume right where it left off once your app comes back into the foreground.

You can see from my purchase success path that I call ovr_IAP_ConsumePurchase within the lambda that resumes once the Oculus purchase UI returns control to my app. I haven't encountered the problem you describe, perhaps add some logging before and after the points were the Purchase UI is invoked and see if it resumes properly? 

en-austin
Protege
@motorsep ,

Yeah, I hear you regarding the lack of Blueprint access to the Oculus platform. In C++ world, I'm also finding a lot of Oculus platform stuff that doesn't exist in Epic's cross-platform frameworks for exposing stuff like IAPs, networking, etc. Luckily in these cases I still have the option to tap into the Oculus native SDKs - but yeah, it's still some digging and such that would be nice not to have to do 🙂

OoKushoO
Honored Guest
Hey Austin, I would love to know how do you use Android studio to debug, the oculus quest.
dont have much experience debugging for android devices

en-austin
Protege
Hi, this video is a bit older but it got me started debugging with Android Studio:
The entire video is a good watch but the Android Studio specific part starts around 13:50

twistedpixel_bob
Expert Protege
I am trying to use a different function from the ovr_platform API and it keeps giving me this error about the library not being linked. error LNK2019: unresolved external symbol ovr_Platform_InitializeStandaloneOculusEx
I included the file in the build.cs file and enabled the plugin as described in the docs.  Was there anything else you needed to do? It seems like it is not linking the library...