playMaker

Author Topic: Need help with Codeless IAP  (Read 621 times)

psguy

  • Playmaker Newbie
  • *
  • Posts: 2
    • View Profile
Need help with Codeless IAP
« on: May 18, 2019, 08:13:32 PM »
Hi everyone!

I need some help with implementing IAP in my project, hoping you guys can help me out.
I've tried Easy IAP and facing trouble with it (looking through the forum posts, at least one other person is having same trouble - it doesn't work on Android build on device.)

Some of the forum posts have said Unity's own Codeless IAP is a good way to go. If so, can someone tell me how do I build logic around it? I mean, how to check if a user has already bought a non-consumable and take actions accordingly etc.?

PlaymakerNOOB

  • Full Member
  • ***
  • Posts: 211
    • View Profile
Re: Need help with Codeless IAP
« Reply #1 on: May 19, 2019, 08:19:36 AM »
You can follow the official documentation here:   https://docs.unity3d.com/Manual/UnityIAPSettingUp.html

Get these Playmaker actions:  https://github.com/dumbgamedev/IAP_Playmaker

In Unity, goto Window > Unity IAP > IAP Catalog

ID = com.psguy.newgame.disablead
Type = Non Consumable

Fill in title + description, as these are what your players will see if they try to buy on IOS/Android.  Then click on App Store Export and pick the export for your store of choice.

Next, you will want to export a copy of the game and upload it to the store of your choice. In my example, I am using google play developer console.  Once thats done, go to the main page of the console:  https://play.google.com/apps/publish/ find your app and click on it.  Then go to Store Presence > In-App Products > Manage Products then click on import / export, locate the file you exported and import it.  save.

basic flow would be to check to see if encrypted player prefs exist (easy save3) or playerprefs. If not, goto state WaitForInput with 2 states called 'Success' and 'Fail'. If purchase success, create playerpref, if purchase failed, reset (goto start state)

Window > Unity IAP > Create IAP Button -- this will make a new button in the scene.  Set the product id (com.psguy.newgame.disablead) to what you made earlier.  Set Button Type to purchase, and it will have 2 settings.  On Purchase Complete and On Purchase Fail.

Have Purchase Complete set to Editor and Runtime with PlaymakerFSM.Send Event, then find the gameobject with the FSM you wish to manage and for the event name call it 'Success'.  Do the same for On Purchase Failed, but have the event name be 'Fail'

psguy

  • Playmaker Newbie
  • *
  • Posts: 2
    • View Profile
Re: Need help with Codeless IAP
« Reply #2 on: May 20, 2019, 02:57:58 PM »
Thank you so very much! That was a wonderfully through walkthrough!

I am out of my country for vacation, today's the first day, can't wait to do this when I get back. :)

I hope you won't mind helping me out in case I get stumped then! You made everything sound very simple and straightforward, hopefully I won't have any hiccups.

Cheers!