x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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.

alt text alt text

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:

alt text

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

alt text

In a "Widget" to "UMG" I've put a button to make the purchase, following the example from this thread: link text

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?

alt text

Thank you very much for help us!

Product Version: Not Selected
Tags:
more ▼

asked Apr 10 '15 at 03:08 PM in Packaging & Deployment

avatar image

Helghast
102 11 16 69

avatar image Terence.Burns Apr 13 '15 at 10:17 AM

Hi Helghast,

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.

/Terence

avatar image Helghast Apr 14 '15 at 11:10 AM

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.

alt text

alt text

link text

link text

avatar image Terence.Burns Apr 14 '15 at 12:21 PM

Hey Helghast,

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

avatar image Helghast Apr 14 '15 at 12:55 PM

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

link text

huawei.zip (131.7 kB)
avatar image Terence.Burns Apr 14 '15 at 02:09 PM

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

avatar image Helghast Apr 15 '15 at 10:04 AM

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

huaweiv1.zip (34.3 kB)
avatar image Terence.Burns Apr 16 '15 at 10:03 AM

hey Helghast,

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

adb logcat -s "UE4"

/T

avatar image Helghast Apr 17 '15 at 11:31 AM

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.

test.txt (2.5 kB)
avatar image Terence.Burns Apr 17 '15 at 12:19 PM

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

avatar image Helghast Apr 17 '15 at 04:40 PM

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

avatar image Terence.Burns Apr 22 '15 at 10:03 AM

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

/Terence

avatar image Helghast Apr 27 '15 at 06:28 PM

I think it's better to wait to 4.8. :)

avatar image Helghast May 01 '15 at 12:53 PM

Awesome. now it works! FullHD-Image:

alt text

Many thxs Terence!

foto0398.jpg (559.7 kB)
avatar image OmniOwl Nov 01 '15 at 01:11 AM

What did you do to make it work?? I still can't figure this out.

avatar image Buggiman Apr 25 '17 at 07:18 AM

Yeah can you please tell me what did you do to make it work?

avatar image Terence.Burns May 01 '15 at 12:54 PM

Excellent :-)

avatar image Vasanth Jun 01 '15 at 01:31 PM

Hi Helghast,

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. alt text

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!

doubt.png (76.3 kB)
avatar image Helghast Jun 01 '15 at 03:14 PM

Don't worry about those extra nodes. They are my custom functions to enable or disable my UMG-button as a result of the transaction. Nothing more.

avatar image Vasanth Jun 01 '15 at 04:00 PM

Thanks for your quick reply. I am not very clear where do you remove ads after the purchase is successful. Can you give some inputs how do you do that?

Thank you

avatar image Helghast Jun 01 '15 at 07:56 PM

Well, if transaction fails, I put a boolean to FALSE and use "Hide Ad banner". Otherwise, call "Show banner".

These are the common nodes:

alt text

ads nodes.png (88.4 kB)
avatar image Vasanth Jun 02 '15 at 08:26 AM

Hi Helghast, Thanks a lot for your kind reply :-) I am having 2 more questions related to this.

  1. I am curious to know how this purchase is saved to the user. My guess is wont it reset if the user re-opens the game? I also came to know that save game API is device specific. How to save this purchase as per the Apple ID? so that the user can benefit on all his devices.

  2. How did you test this feature on iOS? do we have anything similar to alpha mode in Andriod? it would be very helpful if you give some hints on this :-)

Cheers! Thank you :-)

avatar image Helghast Jun 02 '15 at 08:42 AM

I have not tested on iOS, Android only. You can try this for "alphas and betas": https://developer.apple.com/testflight/

Maybe this thread can help you with iOS: https://forums.unrealengine.com/showthread.php?67184-BluePrint-In-App-purchases-IOS-not-working-UE-4-7-5-Win

You can use a "savegame" file to save states using the following nodes: "Create GameObject Save", "Load Game from Slot" and "Save Game to Slot".

Greetings.

avatar image Vasanth Jun 04 '15 at 09:19 AM

Thank you Helghast!

I have been testing this feature on my iOS device for quite a while. it seem always failing like you previously experienced. is Testflight the only way to test this feature or what?? very curious to know.

I would like to know where we can assign the cost for the purchase :-) sorry for so many questions.

Thanks a ton!

avatar image sinspaw Jul 28 '15 at 03:36 PM

Hi Helghast. I was wondering if you could help me.

In your Format Text node, is that all you did for your In App Purchase to work?

"{state};{identifier};{displayname};{description};{price};{data}"

That's all you need for the format text?

And also, where does this format text goes? Where is it necessary in the app?

Thank you.

avatar image Helghast Jul 28 '15 at 04:47 PM

I only use "FT" to display transaction results. It is not necessary.

avatar image Vahid Jul 24 '16 at 01:16 AM

Hi, I've same problem always return failed , also i can't use Read in app purchase information to read info like price and etc, I using 4.12.2

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

hi helghast,

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

     [OnlineSubsystemGooglePlay.Store]
     bSupportsInAppPurchasing=True

/Terence

more ▼

answered May 01 '15 at 10:11 AM

avatar image spaceharry May 01 '15 at 03:37 PM

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.

avatar image BPANDREW May 01 '15 at 03:56 PM

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

avatar image Progab Jul 01 '15 at 04:41 AM

I`m having some issues! I did everything right. Open a dev play store, filled the Google Play license and games app id, changed the DefaultEngine.ini. But i still get failed error while I try to make an in app purchase. It would be awesome if someone helps me <3

avatar image KillerSneak Aug 24 '15 at 10:06 AM

Does this work as it should now? I can't get it to work at all at this moment.

avatar image KillerSneak Aug 24 '15 at 08:21 PM

So I got the actual purchase working, but now I want to test the [Restore In-App Purchases] but it doesn't seem to work at all. Can anybody show me the setup to restore a purchase with the node (if it works)

EDIT Indeed the [Restore In-App Purchases] does not work, it doesn't fire at all (on success or on failure)

avatar image Terence.Burns Aug 25 '15 at 03:00 PM

Hey KillerSneak,

Restoring IAP is not available for Android yet, It should be for 4.10.

/Terence

avatar image OmniOwl Oct 31 '15 at 10:46 PM

I just tried using the Make an In-App Purchase node and nothing happens. It doesn't execute AT ALL.

alt text alt text

I'm using 4.9.2 myself.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question