Search Unity

Simple In-App Purchase System (SIS) - Shop solution

Discussion in 'Assets and Asset Store' started by Baroni, Aug 8, 2013.

?

Which billing plugin are you using in combination with Simple IAP System?

  1. Unity IAP

    173 vote(s)
    86.5%
  2. Voxel Busters

    10 vote(s)
    5.0%
  3. Stans Assets

    13 vote(s)
    6.5%
  4. Prime31

    4 vote(s)
    2.0%
  1. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,260
    Hi Zybrion!
    This has been answered here: http://www.rebound-games.com/forum/index.php?topic=138.msg496#msg496
    Notice the UIPanelStretch component on the IAPItem prefabs.
     
  2. tafer95

    tafer95

    Joined:
    Oct 23, 2014
    Posts:
    44
    Hello,
    is possible that the poblem is because my game are how a "BORRADOR" (Eraser) ? i need first publish my game?

     
  3. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,260
    Borrador means draft in english. Your app needs to be published, as per Google documentation, draft apps are not supported for in-app billing testing.
    http://developer.android.com/google/play/billing/billing_testing.html#draft_apps

     
  4. tafer95

    tafer95

    Joined:
    Oct 23, 2014
    Posts:
    44
    Yes! thank you, i solved the problem
     
  5. biscito

    biscito

    Joined:
    Apr 3, 2013
    Posts:
    138
    i’v a bug, works fin i unity, but on xcode, i get one error

    in this file :
    game/Libraries/Plugins/iOS/AppStoreDelegate.mm

    'release' is unavailable: not available in automatic reference counting mode


    [m_skuMaprelease];

    [m_skusrelease];

    m_skus = nil;

    m_skuMap = nil;

    [super dealloc];

    }



    // Setup


    - (void)requestSKUs:(NSSet*)skus

    {

    m_skus = [skus retain];

    and when change
     
  6. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,260
    I will need more info to reproduce this. Which billing plugin, plugin version, Unity and Xcode version are you using?
     
  7. biscito

    biscito

    Joined:
    Apr 3, 2013
    Posts:
    138
    unity5_21, just now same bug with the unity5_19 on mac

    i'm using SIS 2.4.4 with OpenIAB (openiab-plugin-0.9.7.2 )

    and the last xcode,
     
  8. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,260
    Unity 5 is in beta and not all plugins are supported yet. I would suggest you retry building it with Unity 4.x.
     
  9. biscito

    biscito

    Joined:
    Apr 3, 2013
    Posts:
    138
    hey, well i'm going full metal, 64bit

    http://blogs.unity3d.com/2014/11/20/apple-ios-64-bit-support-in-unity/

    Starting February 1, 2015, new iOS apps uploaded to the App Store must include 64-bit support and be built with the iOS 8 SDK, included in Xcode 6 or later. To enable 64-bit in your project, we recommend using the default Xcode build setting of “Standard architectures” to build a single binary with both 32-bit and 64-bit code.

    ...


    If you have unreleased games currently in production that are still being developed in an older Unity 4.x version, you will need to upgrade either to Unity 4.6.x or Unity 5

    ...

    We will not add iOS 64-bit support for versions of Unity prior to Unity 4.6.


    so 5 for me
     
  10. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,260
    Unity 4.6.2 will contain 64-bit support. It is still in beta and only available as a patch release at the moment (4.6.1p5). http://forum.unity3d.com/threads/4-6-ios-64-bit-beta.290551/

    I don't get Xcode errors when building with Unity 4.6, so I guess that has something to do with it. Please note that the billing plugins in Simple IAP System are developed by 3rd party vendors, not by me. You could ask the OpenIAB guys to have a look at new Unity versions (I will do that too once they are out of beta), or go with 4.6 for now.
     
  11. biscito

    biscito

    Joined:
    Apr 3, 2013
    Posts:
    138
    thx, gonna check that !!
     
  12. Xomanowar

    Xomanowar

    Joined:
    Apr 2, 2014
    Posts:
    40

    I'm quite noob, but I just don't figured out, how to use these NGUI assets which came in the Simple IAP Package
     
  13. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,260
    What exactly do you want to do with them? If you just want to set up SIS with NGUI:
    - import Simple IAP System, NGUI and the billing plugin you want to use into your project
    - Window > Simple IAP System > Plugin Setup, press button "Import NGUI package"
    - in the same window, import the billing plugin compatible package
    You're done.

    If you don't know how to modify the example scenes or prefabs etc. with NGUI, you'll find a lot of written tutorials and videos about it.
     
  14. Xomanowar

    Xomanowar

    Joined:
    Apr 2, 2014
    Posts:
    40
    Yes, I just don't know what I need to do with these files :/ , and I didn't find on the documentations...

    Capturar.JPG

    I tryed to put them on the scene but not happens... :/
     
    Last edited: Jan 27, 2015
  15. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,260
    These files are atlases, build out of multiple textures, used for drawing NGUI elements. You don't put them in the scene and you won't find documentation about them in Simple IAP System, as NGUI has its own documentation.

    NGUI Atlas: Link
    NGUI docs main page: Link
    Video tutorial: Link

    After you're familiar with NGUI, I suggest checking out the example scenes in Simple IAP System (or learn the new Unity UI instead).
     
  16. Xomanowar

    Xomanowar

    Joined:
    Apr 2, 2014
    Posts:
    40
    Ok Thank you, I'll take a look, sorry about the noob questions...

    Is there on the way any integration of IAP with playmaker?
     
  17. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,260
    No, there won't be any PlayMaker actions for SIS, sorry.
     
  18. tafer95

    tafer95

    Joined:
    Oct 23, 2014
    Posts:
    44
    Hello, i need put a simple button for buy one thing
    Example:
    I have the item with ID: XYZ in the IAP Settings and i need put a button in my scene that open the item to buy with ID XYZ ¿How i can do it?
    i don't want use your scenes because it is out of context of my game :/
     
  19. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,260
    You can call IAPManager.PurchaseNonconsumableProduct("XYZ") in your button code directly. The IAPManager has a method for each type of IAP, all starting with "Purchase" (such as PurchaseConsumableProduct etc.).
     
  20. tafer95

    tafer95

    Joined:
    Oct 23, 2014
    Posts:
    44
    Ok thanks, and how i can call the name, description and price?

    Or at least how i can call the price indicated in the Play Store or App Store?
     
    Last edited: Jan 27, 2015
  21. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,260
    IAPManager.GetIAPObject("XYZ").title / description / realPrice.
    Link to Scripting Reference

    App Store prices are only stored internally and automatically updated on shop prefabs (IAPItem prefabs). If you don't use shop prefabs, there's no way to retrieve them manually. This is because you can't be sure that your app actually received them, due to missing internet connection or other reasons. The App Store will show the localized price when your user decides to buy the product.
     
  22. tafer95

    tafer95

    Joined:
    Oct 23, 2014
    Posts:
    44
    Code (CSharp):
    1.     void OnMouseUp() {
    2.  
    3.                  
    4.                             SIS.IAPManager.PurchaseNonconsumableProduct ("no_ads");
    5.                  
    6.  
    7.     }
    Hello, i put this code, but nothing happens (In Android phone) ¿what i need add?
     
  23. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,260
    OnMouseUp does what it says, it detects mouse clicks. As your mobile device obviously does not have a mouse, you need to use Input.GetTouch instead.
     
  24. iEpic

    iEpic

    Joined:
    Sep 29, 2013
    Posts:
    119
    Hey.
    Everything was has been working fine the last few days, but tonight I let my daughter play my game and I'm not sure what she did exactly but for some reason my in-app purchases aren't working anymore.

    This is the error I keep getting, and when I click on the error while it's running it's showing it's coming from the buyButton attached to IAPItem 000

    NullReferenceException: Object reference not set to an instance of an object
    SIS.IAPManager.PurchaseVerified (System.String id) (at Assets/SIS/Scripts/IAPManager.cs:441)
    SIS.IAPManager.PurchaseSucceeded (.PurchasableItem item) (at Assets/SIS/Scripts/IAPManager.cs:321)
    Unibiller._onPurchaseComplete (.PurchaseEvent e) (at Assets/Plugins/unibill/src/impl/Unibiller.cs:478)
    Unibill.Biller.onPurchaseSucceeded (System.String id, System.String receipt) (at Assets/Plugins/unibill/src/impl/Biller.cs:173)
    Tests.FakeBillingService.purchase (System.String item, System.String developerPayload) (at Assets/Plugins/unibill/src/impl/FakeBillingService.cs:39)
    Unibill.Biller.purchase (.PurchasableItem item, System.String developerPayload) (at Assets/Plugins/unibill/src/impl/Biller.cs:128)
    Unibill.Biller.purchase (System.String purchasableId, System.String developerPayload) (at Assets/Plugins/unibill/src/impl/Biller.cs:137)
    Unibiller.initiatePurchase (System.String purchasableId, System.String developerPayload) (at Assets/Plugins/unibill/src/impl/Unibiller.cs:257)
    SIS.IAPManager.PurchaseProduct (System.String productId) (at Assets/SIS/Scripts/IAPManager.cs:290)
    SIS.IAPManager.PurchaseConsumableProduct (System.String productId) (at Assets/SIS/Scripts/IAPManager.cs:296)
    SIS.IAPItem.Purchase (UnityEngine.GameObject button) (at Assets/SIS/Scripts/IAPItem.cs:270)
    UIEventListener.OnClick () (at Assets/NGUI/Scripts/Internal/UIEventListener.cs:42)
    UnityEngine.GameObject:SendMessage(String, Object, SendMessageOptions)
    UICamera:Notify(GameObject, String, Object) (at Assets/NGUI/Scripts/UI/UICamera.cs:1085)
    UICamera:processRelease(Boolean, Single) (at Assets/NGUI/Scripts/UI/UICamera.cs:1849)
    UICamera:processTouch(Boolean, Boolean) (at Assets/NGUI/Scripts/UI/UICamera.cs:1888)
    UICamera:processMouse() (at Assets/NGUI/Scripts/UI/UICamera.cs:1431)
    UICamera:processTouches() (at Assets/NGUI/Scripts/UI/UICamera.cs:1512)
    UICamera:Update() (at Assets/NGUI/Scripts/UI/UICamera.cs:1237)
     
  25. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,260
    Hi, line 441 points to purchaseSucceededEvent(id). Before that, PurchaseSucceeded() receives the product id from Unibill, stored in a PurchasableItem. Could you debug that this item and id are not null and that it's actually the product you are expecting? Repro steps would help.

    The purchaseSucceededEvent can only throw a NullReferenceException if you've deleted all listeners to it (especially IAPListener) in your scene. Maybe that's a hint too.
     
  26. iEpic

    iEpic

    Joined:
    Sep 29, 2013
    Posts:
    119
    Yep It was the IAPListener!
    Thanks man you are awesome!
    I'm not sure how the Script got unchecked but that fixed it
     
    Baroni likes this.
  27. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,260
    Version 2.5

    - added product upgrades which replace their associated product,
    allowing for different price/icon/etc after each purchase
    - IAPManager: added GetIAPUpgrades, GetCurrentUpgrade, GetNextUpgrade
    - restructured documentation to be more useful with less to read

    Seriously, if you haven't read the documentation before, now is the best time to do so! I've shrinked 27 pages (before) on 13 pages (after), including a new FAQ section. Upgradeable products look like this:



     
    RoyalCoder likes this.
  28. Xomanowar

    Xomanowar

    Joined:
    Apr 2, 2014
    Posts:
    40
    Hi, i'm receiving this error:

    Assets/SIS/Editor/IAPEditor.cs(50,70): error CS0117: `SIS.IAPPlatform' does not contain a definition for `Amazon'

    I created a entire new project, and only installed NGUI,SIS,Playmaker, Stans Android Plugin...
     
  29. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,260
    Hey, please finish the integration by selecting your correct plugin under Window > Simple IAP System > Plugin Setup (after pressing the NGUI button, in your case).
     
  30. Xomanowar

    Xomanowar

    Joined:
    Apr 2, 2014
    Posts:
    40

    I tried this three times, but still receiving the same error.





    Is something missing here? I'm a playmaker user, I don't know almost nothing of codes sorry.


     
  31. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,260
    Thanks for confirming this and sorry, there has been a packaging mistake indeed. I'm preparing a fix for tomorrow.
     
  32. Xomanowar

    Xomanowar

    Joined:
    Apr 2, 2014
    Posts:
    40
    No problem, thks for the support.
     
  33. tafer95

    tafer95

    Joined:
    Oct 23, 2014
    Posts:
    44

    Hello, i have this error and i aggregate correctly the ID in the IAP settings and i written the code in the script of IAPListener

    what i can do?
     
  34. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,260
    Hi tafer, your setup looks correct. Please start your game from the first scene, where your IAPManager prefab is located. Otherwise the DBManager, which you are accessing, will not get initialized.
     
  35. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,260
    Fixed in 2.5f1, please re-download.
     
  36. tafer95

    tafer95

    Joined:
    Oct 23, 2014
    Posts:
    44
    Code (CSharp):
    1.     case "13000coins":
    2.                        if (PlayerPrefs.HasKey ("totalCoins")){
    3.                    
    4.                     PlayerPrefs.SetInt ("totalCoins", PlayerPrefs.GetInt ("totalCoins") + 13000);
    5.                    
    6.                 } else {
    7.                    
    8.                    
    9.                     PlayerPrefs.SetInt ("totalCoins", 13000);
    10.                    
    11.                 }
    12.                 GameObject.Find ("CoinsContainer").transform.Find ("Text").GetComponent<TotalMonedas>().Start();
    13.                 //DBManager.IncreaseFunds("seismilcoins", 1000);
    14.                 ShowMessage("13000 coins purchased.");
    15.                 break;
    Hello, i am testing the IAP and i buy this product and happened nothing, why?, don't show message and don't save the playerPrefs (I don't use DBManager for increase Founds because i use PlayerPrefs for save the coins of the player)

    I buy a non consumable product and this work good, but not show the message that i put with ShowMesage and the scene don't refresh when i buy the product, i need close and open the scene for i see the item "SOLD"...
     
  37. Xomanowar

    Xomanowar

    Joined:
    Apr 2, 2014
    Posts:
    40
    Does exist some difference on the scripting part of the vídeo "
    Unity - Simple IAP System (SIS) - Getting Started with OpenIAB"

    On using the Stan's Android Native Plugin?

    Because I fallowed each step of the vídeo, but my store just appear empty, the Stan's Plugins is working because I'm getting the name of the user and etc...
     
  38. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,260
    Please use DBManager.IncreaseFunds("coins", 13000) for storing your virtual currency. It's the same as your code, just more automated. You need a ShopManager prefab in the scene and assign a window/text in its inspector to show messages.
     
  39. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,260
    No, no differences. Is your IAPManager prefab in the first scene, ShopManager in the shop scene and do you start your app from the first scene?
     
  40. Xomanowar

    Xomanowar

    Joined:
    Apr 2, 2014
    Posts:
    40
    IAPManager is on the shop scene, ShopManager also is there .. My first scene on the game is the "Splashscreen" need I put IAPManager there?
     
    Last edited: Jan 31, 2015
  41. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,260
    If that is your first scene, then yes.

    Also make sure that your prefabs/container are defined in the IAP Settings editor, while you're in the shop scene.
     
  42. Xomanowar

    Xomanowar

    Joined:
    Apr 2, 2014
    Posts:
    40
    I'll revise everything here, I'll post the result here soon, thank you for the support.
     
  43. Xomanowar

    Xomanowar

    Joined:
    Apr 2, 2014
    Posts:
    40
    I followed each step of the video, Now when I'm at the store, I receive the message that I need to be connected, (but I'm already connected), sounds like Stan's Plugin and SIS are not communicating each other. I let propositally the "description" field different from Google setup to see if "fetch" is working.. but also seems to be doing nothing.

    Also I checked that my container is correctly set on the IAP Settings, I put a action (playmaker) Don't destroy on load on the IAPManager (which is loaded at the splashscreen of my game)
     
  44. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,260
    @TBrayner could you please send your project, screenshots/video or repro steps to info [at] rebound-games [dot] com.
     
  45. Xomanowar

    Xomanowar

    Joined:
    Apr 2, 2014
    Posts:
    40
    Hi Baroni, I did a cleanup on everything, and I downloaded again the Stan's Android Native and SIS, and now seems the things are moving on... now i'm receiving a message saying that my App is not configured or something like that to billing with google, but, by what I google... this happens because my APK isn't the same which was uploaded on Google Play. So my question now is, where I get this coins values (variables) and start to manipulate them on the game?
     
  46. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,260
    If your user buys coins, you would do that in the IAPListener script by adding DBManager.IncreaseFunds("coins", 100). The same applies for earning coins in-game, but in this case you would do that in your game script directly. Please refer to the scripting reference (link in the documentation) for an overview of all methods.
     
    Xomanowar likes this.
  47. Xomanowar

    Xomanowar

    Joined:
    Apr 2, 2014
    Posts:
    40
    Hi Baroni, sorry about bothering you with this :/

    As I'm not a developer (I'm a playmaker user) it's very hard for me to understand all that documentation (I swear, I tried), When I bought the "Simple" IAP System I thought it was simple as a playmaker to use (my fault :/)...



    I have some other questions (after dig a little more).



    So, I understood that the DBManager deal with all data, and the IAPListener fire the events when a puchase is made.

    So in my case I put this lines on IAPListener. (my product "coin_pack_001")


    case "coin_pack_001":
    //the user bought the item "coin_pack_001",
    //increase coins by 1000 and show appropriate feedback
    DBManager.IncreaseFunds("coins", 1000);
    ShowMessage("1000 coins were added to your balance!");
    break;



    I would to know if you can help me to fire an event in a GameObject with a FSM (Playmaker) on it.
    I only want to fire an event which allows me to fill my Playmaker Global Variable (Coins:Int) with the same value
    I have on the DBManager.

    This Video seems to help to understand how to do this (fire an playmaker event from a script), but my lack of knowedge as a programmer is a huge wall for me in this case.

    Minute 4:55


    Game Object which contains the Playmaker FSM


    Event I want to fire "in Yellow" event_coin_pack_001


    So, if get to fire this Playmaker event when a new purchase is made, I can start to move on in my game, because I already made the store works (i mean, I already can purchase itens, this already is working).
     
    Last edited: Feb 2, 2015
  48. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,260
    Create a new C# script with the code below and attach it to your PlaymakerCoinHandleSystem game object with the FSM:

    Code (csharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using SIS;
    4.  
    5. public class PlaymakerListener : MonoBehaviour
    6. {
    7.    private PlayMakerFSM fsm;
    8.  
    9.    void Start()
    10.    {
    11.       fsm = GetComponent<PlayMakerFSM>();
    12.    }
    13.  
    14.    void OnEnable()
    15.    {
    16.       IAPManager.purchaseSucceededEvent += DoEvent;
    17.    }
    18.  
    19.    void OnDisable()
    20.    {
    21.       IAPManager.purchaseSucceededEvent -= DoEvent;
    22.    }
    23.  
    24.    void DoEvent(string id)
    25.    {
    26.       switch(id)
    27.       {
    28.          case "coin_pack_001":
    29.             //set your global coins value
    30.             FsmInt coinsVar = FsmVariables.GlobalVariables.FindFsmInt("Coins");
    31.             coinsVar.Value = DBManager.GetFunds("coins");
    32.          
    33.             //fire PlayMaker event on your FSM
    34.             fsm.SendEvent("event_coin_pack_001");
    35.             break;
    36.       }
    37.    }
     
    Xomanowar and RoyalCoder like this.
  49. Xomanowar

    Xomanowar

    Joined:
    Apr 2, 2014
    Posts:
    40
    Thank you so much Baroni, This will help me a lot! :)
     
    Last edited: Feb 2, 2015
  50. Xomanowar

    Xomanowar

    Joined:
    Apr 2, 2014
    Posts:
    40
    I'm receiving this error:

    Assets/_Scripts/IAPListenerToPlaymaker.cs(31,25): error CS0246: The type or namespace name `FsmInt' could not be found. Are you missing a using directive or an assembly reference?