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"

Are there any in app purchase tutorials for android out there?

I followed the documentation Unreal has provided, but it is REALLY limited, and the explanation isn't very clear. First off, it is using the Unrreal Match 3 example to show how it is done, which is fine. But, it only covers one item. What if you have multiple items? Do you have to set them up separately in the same manner, or can they all be lumped into an array? I tried looking at the blueprints themselves within the project, and I am still very confused. How do I make sure that the purchased items stay in tact (i.e. if a user uninstalls my app and reinstalls later). Simply saving a bool variable as true or false doesn't seem like the best option, as the variables coincide with the save file (or am I missing something?). So if the save file gets deleted, how do I make it so my users don't have to repurchase non-consumable items? (Such as removing ads).

I should note that this is my first time doing in-app purchases, so my understanding of all of this is very limited. A decent tutorial or more info on the documentation would really be helpful. Does anyone know of a good tutorial that covers this?

Product Version: UE 4.12
more ▼

asked Jul 17 '16 at 07:35 PM in Blueprint Scripting

avatar image

13 1 2 6

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

1 answer: sort voted first

If you are getting prices for your sale items you put all IDs in an array, even if it's just one it belongs in an array.

When you are making a purchase you make a purchase with only one ID.

When you request to restore in-app purchases any non-consumed purchases are returned.

Make sure the user is logged in before attempting any purchase, leaderboard, or achievement calls.

When looking for the blueprint nodes make sure you choose the ones with the blocky icon as shown circled in red, and NOT the function node.

Don't forget to setup your Google Play License key and Games App ID. I don't have a link to this information immediately but it's pretty easy to find.

alt text

in-app-help.png (320.1 kB)
more ▼

answered Jul 18 '16 at 07:09 AM

avatar image

536 33 22 39

avatar image TrayJ Jul 18 '16 at 07:56 AM

Thanks for responding. But, I am still a bit lost. Where do I insert this logic into? The store screen I created? Or some place else? The Unreal Match 3 example was passing a bunch of info back and forth between the store screen, confirmation screen, and the game instance (or at least that was what I took away from it). Your set up looks far less complicated, though. You mentioned setting up my license key and app ID. Do you mean the section in the project settings, in google play developer console or somewhere else?

Sorry for all of the questions. This is totally uncharted territory for me, and this is the last thing I need to set up in my game.

avatar image Distul Jul 18 '16 at 03:40 PM

It's much less complicated than their example. I used this code in my store front widget. Any section that retains variables and allows timers should work. So macros, functions, and function libraries for example would not work. Widgets and actors should. Yes, I was referring to the project settings about your Google license.

avatar image TrayJ Jul 18 '16 at 05:35 PM

ok, a few more questions. Are these nodes connected to a custom event for each of them, or something else? On the sections with the ForEachLoop, what am I processing through those?

avatar image TrayJ Jul 19 '16 at 05:35 PM

I tried this using custom events, and it is still not functioning.

avatar image Distul Jul 19 '16 at 06:02 PM

Custom events will work.

It's worth mentioning that you cannot test from within the editor. You must compile the app and push it to your phone. Also, you must submit a testing version to your Google Developer Console within Alpha or Beta testing. The version number must match the version number as what you've uploaded to your Google Developer Console. You can then make as many changes to your local copy as you want long as the version number matches what's online.

You will also need to setup purchases and testers on your Google Developer Console. Refer to Google support for that, because it changes frequently. It's pretty easy to figure out on your own though.

Using Read In-App Purchases is fairly simple. You provide an array of purchaseIDs you wish to gather information on. When successful, you process the ForEachLoop breaking each result and taking information from the structure.

Restore In-App Purchases is the same thing except you don't provide an array of IDs, and it returns back only purchases made with receipt data such as cost, dates, so on.

avatar image TrayJ Jul 19 '16 at 06:27 PM

alt text

Is this array being created from my google play list of in-app purchases? And is this the array I am then pulling information from? Or do I set up the array locally?

I already have uploaded the compiled beta version to the developer console and have tested it on my device from there. I have two options in my store currently. One is a simple remove ads option. The other is a "season pass" that removes ads and allows all non-consumable dlc to be free. When I hit either button in my store widget (while testing on my device), nothing happens.

array.jpg (164.1 kB)
avatar image Distul Jul 20 '16 at 05:08 PM

There are several problems you may be running into. You're using your package name as an array string, which you should be using your in-app purchase ID. In your Google Developer Console visit your 'In App Products" and add a new pin in your array for every product, containing the ID(not the name).

Secondly, you aren't even processing anything in your loop. See more information on For Each Loops here: https://wiki.unrealengine.com/Blueprint_Essentials_-_12_-_For_Each_Loop

Lastly, print string will only be visible on your phone if you are compiling a debug/non-distribution version.

Some of your problems are unrelated to in-app purchases. If you have a specific question to anything other than in-app purchases(eg: for each loops) start a new question please. There is plenty of information here to get started.

avatar image TrayJ Jul 22 '16 at 04:59 AM

Sorry. I read the Your Product part of your array in your screenshot wrong. I replaced the project names with the product IDs. I understand what a forEachLoop does. What I am questioning is, do I need to set the return information to a new array (such as prices)?

As I said before, this is the first time I have done IAPs in Unreal, so forgive me for not understanding it completely on the first try.

(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