Android and iOS In-app purchase issue

My team and I are trying to finish to setting up online purchases in our application for Android and IOS.
We have now running properly all the banners for ads and we want to buy a product from “GooglePlay” to disable the ads in the game.

There isn’t much information to configure this purchase service for UnrealEngine and Android/ IOS, and looking in Answerhub we decided to configure the DefaultEngine.ini with the following lines:

38316-defaultengine+conf.png

We also set the Build.cs with the following lines:

In a “Widget” to “UMG” I’ve put a button to make the purchase, following the example from this thread:
[link text][5]

But when I package the project and upload it to GooglePlay in Alpha mode, and test it in “Android” device, I always get “Failed” when I try to buy some items. (Although I’ve didn’t tested it on iOS yet)

What are we missing or what have we done incorrectly in the DefaultEngine or Buil.cs or Blueprint?
In the “Make InAppPurchaseProductRequest” node, the “Product Identifier” must be the ID from the item or ID from the application?

Thank you very much for help us!

Hi

From looking the information that you have provided, I would ensure that you have an entry for both of these:

[OnlineSubsystemGooglePlay.Store]
IsAllowedToMakePurchases=True

[/Script/AndroidRuntimeSettings.AndroidRuntimeSettings]
bEnableGooglePlaySupport=True

in your config file. On the topic of IOS, you will need to add the OSSIOS to your *.build.cs file:

DynamicallyLoadedModuleNames.Add("OnlineSubsystemIOS");

I hope this is useful.

/

Well, I made the suggested changes, but in my device when trying to make the purchase, returns Failed.

Here are the changes. I do not know why it fails again.

38667-failed.png

[link text][3]

[link text][4]

Hey

This looks better. Is it possible for you to send me the logs from the android device where this fails?

We might be able to gather some information from there.

/T

Yep, here are logcat from an android device (huawei P7-L10 - android v4.4.2):

link text

Hey, that log is a far too verbose.

Can you access the android device through windows and grab the latest log from your games installed folder.

/T

Hey, I can’t find “latest log from my games installed folder”.
However, i can get a “logcat” only with errors and less verbose.

link text

hey

These logs are just as verbose. Can you run adb logcat with the “UE4” filter:

adb logcat -s “UE4”

/T

Well, with "adb logcat -s “UE4"” only shows “--------- beginning of /dev/log/main”.
Using debug with “logcat.-enable”, when button is pressed I get some lines like these:

link text

Also I added test-users in my alpha application.
Thx a lot.

hey, are you running the a game whilst it is connected to your pc via usb cable?

Hi, device is connected only when I use “logcat” or installing apk+obb.

Hey
You’ll need to keep the device connected whilst running, for UE4 log to be routed through adb.

/

I think it’s better to wait to 4.8. :slight_smile:

Sorry for the delay, but I created an APK in development mode and “logcat” shows:

D/UE4     ( 7116): [2015.04.28-10.02.49:994][  0]LogScript:Warning: UInAppPurchaseCallbackProxy::Trigger - In-App Purchases are not supported by Online Subsystem

link text

hi

It still looks like the OSS Store isnt being initialized. Could you just add the following:

    [OnlineSubsystemGooglePlay.Store]
    bSupportsInAppPurchasing=True

/

Awesome. now it works! FullHD-Image:

Many thxs !

Excellent :slight_smile:

Not sure if I am right or if this change is already done for 4.8 or 4.9, but consumable IAP bool doesn’t work as intended yet. Line 163 in OnlineStoreInterfaceGooglePlay.

bCreatedNewTransaction = AndroidThunkCpp_Iap_BeginPurchase(ProductRequest.ProductIdentifier, ProductRequest.bIsConsumable); // TPMB - update begin purchase to use a consumable flag.

THANK YOU - this was the block I was having as well

Hi

I am new to Unreal. Thanks for this forum. I have the same doubts but unfortunately couldnt get what happens in this section of your code.

44855-doubt.png

Can you please explain what you have done in this section? It will be very helpful for me to create for my game. Thanks a lot!