06-02-2020 02:16 AM
Solved! Go to Solution.
06-09-2020 12:24 PM
const IOnlineSubsystem* OnlineSub = Online::GetSubsystem(GetWorld(), OCULUS_SUBSYSTEM);
check(OnlineSub);
const FOnlineSubsystemOculus* OculusSubsystem = static_cast<const FOnlineSubsystemOculus*>(OnlineSub);
check(OculusSubsystem);
UE_LOG_VR(Verbose, TEXT("Attempting to buy %d coins with SKU '%s'"), Amount, *SKU);
const char* c_sku = TCHAR_TO_ANSI(*SKU);
OculusSubsystem->AddRequestDelegate(
ovr_IAP_LaunchCheckoutFlow(c_sku),
FOculusMessageOnCompleteDelegate::CreateLambda([this, c_sku, Amount](ovrMessageHandle Message, bool bIsError)
{
if (bIsError)
{
UE_LOG_VR(Error, TEXT("Purchase Error of %s"), c_sku);
}
else
{
ovrPurchaseHandle Handle = ovr_Message_GetPurchase(Message);
ovrID ID = ovr_Purchase_GetPurchaseID(Handle);
UE_LOG_VR(Verbose, TEXT("Purchase Success (%llu)"), ID);
ovr_IAP_ConsumePurchase(c_sku);
}
06-12-2020 09:28 AM
06-09-2020 12:24 PM
const IOnlineSubsystem* OnlineSub = Online::GetSubsystem(GetWorld(), OCULUS_SUBSYSTEM);
check(OnlineSub);
const FOnlineSubsystemOculus* OculusSubsystem = static_cast<const FOnlineSubsystemOculus*>(OnlineSub);
check(OculusSubsystem);
UE_LOG_VR(Verbose, TEXT("Attempting to buy %d coins with SKU '%s'"), Amount, *SKU);
const char* c_sku = TCHAR_TO_ANSI(*SKU);
OculusSubsystem->AddRequestDelegate(
ovr_IAP_LaunchCheckoutFlow(c_sku),
FOculusMessageOnCompleteDelegate::CreateLambda([this, c_sku, Amount](ovrMessageHandle Message, bool bIsError)
{
if (bIsError)
{
UE_LOG_VR(Error, TEXT("Purchase Error of %s"), c_sku);
}
else
{
ovrPurchaseHandle Handle = ovr_Message_GetPurchase(Message);
ovrID ID = ovr_Purchase_GetPurchaseID(Handle);
UE_LOG_VR(Verbose, TEXT("Purchase Success (%llu)"), ID);
ovr_IAP_ConsumePurchase(c_sku);
}
06-09-2020 12:41 PM
en-austin said:
Hi,Though we're not specifically using ovr_IAP_GetProductsBySKU, we are using IAPs with Quest for the past few UE4 versions (I believe starting with 4.22). Below is a snippet of code that executes when the player makes a choice for an IAP on our UI:const IOnlineSubsystem* OnlineSub = Online::GetSubsystem(GetWorld(), OCULUS_SUBSYSTEM);
check(OnlineSub);
const FOnlineSubsystemOculus* OculusSubsystem = static_cast<const FOnlineSubsystemOculus*>(OnlineSub);
check(OculusSubsystem);
UE_LOG_VR(Verbose, TEXT("Attempting to buy %d coins with SKU '%s'"), Amount, *SKU);
const char* c_sku = TCHAR_TO_ANSI(*SKU);
OculusSubsystem->AddRequestDelegate(
ovr_IAP_LaunchCheckoutFlow(c_sku),
FOculusMessageOnCompleteDelegate::CreateLambda([this, c_sku, Amount](ovrMessageHandle Message, bool bIsError)
{
if (bIsError)
{
UE_LOG_VR(Error, TEXT("Purchase Error of %s"), c_sku);
}
else
{
ovrPurchaseHandle Handle = ovr_Message_GetPurchase(Message);
ovrID ID = ovr_Purchase_GetPurchaseID(Handle);
UE_LOG_VR(Verbose, TEXT("Purchase Success (%llu)"), ID);
ovr_IAP_ConsumePurchase(c_sku);
}
06-09-2020 01:01 PM
06-09-2020 01:06 PM
06-12-2020 05:33 AM
I've followed the instruction on the website and everything seems fine, at least no complaint from VS.
en-austin said:
The Oculus Online Subsystem gets initialized upon application boot, provided you have valid AppId keys configured in your DefaultEngine.ini under the heading [OnlineSubsystemOculus] and the Online Subsystem plugin enabled in your project.You can trace the code and output logs through OnlineSubsytemOculus.cpp - follow the InitWithWindowsPlatform function for Rift/S and InitWithAndroidPlatform function for Qo/Quest.This is the document I referenced when setting our app up initially:
06-12-2020 07:32 AM
06-12-2020 09:09 AM
06-12-2020 09:12 AM
06-12-2020 09:13 AM
en-austin said:
Hi @motorsep ,Not likely for our project - I'm comfortable with C++ and our Blueprint developers are happy making gameplay rather than getting too bogged down with platform details. I'm guessing your project is more Blueprint driven?We do use Blueprint to create the initial Oculus Session ("room" in Oculus terms), and also catch and handle any errors network disconnection errors - but this is mostly for the ease of driving our UI through UMG.