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

    66 vote(s)
    82.5%
  2. Voxel Busters

    5 vote(s)
    6.3%
  3. Stans Assets

    9 vote(s)
    11.3%
  4. Prime31

    0 vote(s)
    0.0%
  1. Nadan

    Nadan

    Joined:
    Jan 20, 2013
    Posts:
    330
    Thank you Baroni! You saved my day.

    At first this didn't work, so at first I needed to remove the SIS from project. Then I followed your instructions above. I only unpacked the 'UnityIAP' unitypackage file at UnityPurchasing folder. There are also 'UPD' and 'UnityChannel' but are these required?

    I also removed the 'In App Purchasing' from Packages. Window > Package Manager. But do I need to reimport that too?

    Right now there are no errors.
     
    Baroni likes this.
  2. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,272
    UPD is Unity's new distribution platform feature for sending your app to stores in Asia - this is optional. UnityChannel contains XiaomiMiPay classes, which is optional too at first, but this package also contains other classes needed when using our receipt validation features.

    The Package Manager package is not required. It has dependencies the other way around - the Package Manager package does not work without the Unity IAP service package.
     
    Nadan likes this.
  3. Chaz32621

    Chaz32621

    Joined:
    Apr 17, 2015
    Posts:
    198
    Im getting this error, and I have no clue why.

    MethodAccessException: Method `UnityEngine.VR.VRSettings.get_enabled()' is inaccessible from method `UnityEngine.Purchasing.GooglePlayAndroidJavaStore.Purchase(string,string)'
    04-13 11:52:10.355 13312 13355 E Unity : at (wrapper managed-to-native) System.Object.__icall_wrapper_mono_throw_method_access(intptr,intptr)
    04-13 11:52:10.355 13312 13355 E Unity : at UnityEngine.Purchasing.GooglePlayAndroidJavaStore.Purchase (System.String productJSON, System.String developerPayload) [0x00019] in <4d0cb115fad04af59efcffe23f032975>:0
    04-13 11:52:10.355 13312 13355 E Unity : at UnityEngine.Purchasing.JSONStore.Purchase (UnityEngine.Purchasing.ProductDefinition product, System.String developerPayload) [0x00129] in <4d0cb115fad04af59efcffe23f032975>:0
    04-13 11:52:10.355 13312 13355 E Unity : at UnityEngine.Purchasing.PurchasingManager.InitiatePurchase (UnityEngine.Purchasing.Product product, System.String developerPayload) [0x0003c] in <2abeedd3020a43afa91d367b26a24e86>:0
    04-13 11:52:10.355 13312 13355 E Unity : at UnityEngine.Purchasing.PurchasingManager.InitiatePurchase (UnityEngine.Purchasing.Product product) [0x00000] in <2abeedd3020a43afa91d367b26a24e86>:0
    04-13 11:52:10.355 13312 13355 E Unity : at SIS.IAPManager.PurchaseProduct (System.St
    04-13 11:52:19.433 13312 13355 E Unity : MethodAccessException: Method `UnityEngine.VR.VRSettings.get_enabled()' is inaccessible from method `UnityEngine.Purchasing.GooglePlayAndroidJavaStore.Purchase(string,string)'
    04-13 11:52:19.433 13312 13355 E Unity : at (wrapper managed-to-native) System.Object.__icall_wrapper_mono_throw_method_access(intptr,intptr)
     
  4. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,272
    @Chaz32621 Unfortunately I cannot see any SIS related methods in your log. If this comes directly from Unity IAP, please try posting this on the official Unity IAP section instead.
     
  5. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    2,007
    Hi, Is there a method for unlocking everything via an IAP? Thanks
     
  6. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,272
    @derkoi What do you mean by unlocking everything? You are controlling what is granted to the user, or how far he/she can progress, by checking whether the specific product is owned by the user or not.

    Please register on our dedicated support forum, which is set up to also allow sharing code.
     
  7. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    2,007
    I just wondered if there was an easy way to unlock all the IAP purchases in the game, EG all levels and all weapons.
     
  8. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,272
    @derkoi For levels, you would do a

    if (DBManager.isPurchased(level1_iap) || DBManager.isPurchased(all_iap))

    before starting or initializing the level(s). For weapons you would call DBManager.SetPurchase in the IAPListener callback to unlock other products as well. This also works with restoring purchases later on.
     
    derkoi likes this.
  9. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    2,007
    Perfect, thanks
     
  10. MarcusTheMainMan

    MarcusTheMainMan

    Joined:
    Nov 29, 2012
    Posts:
    196
    Unity 2019.1 gives this error in every game. As such one can not compile the game and can not do much until it is fixed. I tried setting up an account on your website but it will not accept the unity invoice number.

    Assets\SimpleIAPSystem\Scripts\VRGraphicRaycaster.cs(325,36): error CS0234: The type or namespace name 'ScriptingUtils' does not exist in the namespace 'UnityEngineInternal' (are you missing an assembly reference?)
     
  11. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,272
    @SupremeEnchanter Thanks, I'm looking into it. Could you please try registering again? Maybe your formatting was incorrect, the field accepts INxxxx and 303xxx invoice ids.

    If that doesn't work, please send your invoice via email so I can check that out as well.

    Edit: In the VRGraphicRaycaster script, all calls to UnityEngineInternal.ScriptingUtils.CreateDelegate should be replaced with just Delegate.CreateDelegate. I will prepare a new version for the Asset Store very soon.
     
    Last edited: Apr 17, 2019
    Glitch12 likes this.
  12. MarcusTheMainMan

    MarcusTheMainMan

    Joined:
    Nov 29, 2012
    Posts:
    196
    I have IAP setup for android play store. I was wondering how to set IAP for windows store? I assume they are similar.
     
  13. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,272
    @SupremeEnchanter In Simple IAP System, nothing changes when building for an additional platform. If you are looking for a Windows Store guide, please see the official manual.

    Also, as I wrote before, please contact us if you're having issues registering on our forum - this is not optional. We're answering general questions on this forum, but are doing support only on our forum.
     
  14. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    2,007
    Sorry to post in here again, I tried to log into my forum account but it says my credentials are not correct, so I tried to change my password but I never receive the email.

    Anyway, I'm using the following with a text array of strings (AllTackleVenueIAPIds) for each IAP id and some players are reporting that they're not receiving all the content unlocked, I check their data (as I save it to playfab and it does only show the 'unlock_everything' purchase and nothing else, it should unlock all items, set remove_ads to purchase and give them 1000 coins, can you see anything here that could be an issue:


    Code (CSharp):
    1.   public void HandleSuccessfulPurchase(string id)
    2.     {
    3.         if (PurchaseSound != null) audioSource.PlayOneShot(PurchaseSound, PurchaseSoundVolume);
    4.  
    5.         //differ between ids set in the IAP Settings editor
    6.         if (IAPManager.isDebug) Debug.Log("HandleSuccessfulPurchase: " + id);
    7.         IAPObject obj = IAPManager.GetIAPObject(id);
    8.  
    9.         //if the purchased item was non-consumable,
    10.         //additionally block further purchase of the shop item
    11.  
    12.         if (obj.type != ProductType.Consumable) DBManager.SetPurchase(id);
    13.  
    14.         switch (id)
    15.         {
    16.             case "remove_ads":
    17.                 MobileAdsManager.Instance.RemoveAds();
    18.                 break;
    19.             case "unlock_everything":
    20.  
    21.                 //Set all to purchased
    22.                 for (int i = 0; i < AllTackleVenueIAPIds.Length; i++)
    23.                 {
    24.                     if (!DBManager.isPurchased(AllTackleVenueIAPIds[i]) DBManager.SetPurchase(AllTackleVenueIAPIds[i]);
    25.                 }
    26.  
    27.                 DBManager.IncreaseFunds("coins", 1000);
    28.                 if (!DBManager.isPurchased("remove_ads")) DBManager.SetPurchase("remove_ads");
    29.  
    30.                 break;
    31.         }
    32.     }
    Also, a player got a refund for the IAP which made me wonder, what's to stop someone making an IAP and receiving the items then getting a refund? Is there anything to address that?

    Thanks
     
  15. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,272
  16. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    2,007
  17. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    2,007
    I've registered again with another email address...
     
  18. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,272
    We're going to check existing email addresses very soon for the registration issue, they're somehow still floating around in our database.
     
  19. Chaz32621

    Chaz32621

    Joined:
    Apr 17, 2015
    Posts:
    198
    Same happened to me hence why I have used these fourms for the time.
     
  20. Chaz32621

    Chaz32621

    Joined:
    Apr 17, 2015
    Posts:
    198
    Any reason why the recipient would fail validation?
     
  21. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,272
    Could you please elaborate? What recipient? Which validation?
     
  22. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,272
  23. MarcusTheMainMan

    MarcusTheMainMan

    Joined:
    Nov 29, 2012
    Posts:
    196
    My bad. I missed that reply.
     
  24. MarcusTheMainMan

    MarcusTheMainMan

    Joined:
    Nov 29, 2012
    Posts:
    196
    I have a couple of quick questions.

    1) I'd like to have a restore in the list. Is the picture how it is supposed to be done? this is what I gathered from the instructions? Do I just leave the price empty?

    2) What happens if using the following code, that the user is not connected to the internet? Does it return a not purchased? The reason is that I would like to save a variable to player prefs. Then instead of checking online, it would check the player prefs.
    if (DBManager.isPurchased("proversion"))

    3) With #2 above, if the player deletes the player prefs then I would need a way to check again. Is this what restore is for or should I just use if (DBManager.isPurchased("proversion"))?

    thanks.
     

    Attached Files:

    Chaz32621 likes this.
  25. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,272
    @SupremeEnchanter Please contact us via email with your Unity invoice number if you're having issues registering on our support forum.
     
  26. N3M3SIS1

    N3M3SIS1

    Joined:
    Feb 25, 2013
    Posts:
    50
    Hello. I have been tasked with the creation of an app prototype where the users can do money transfers via paypal. In other words, the users need to input the amount of money they want to send and to which paypal address they want to send it to, and thus make the transfer. Would this assets help me speed out the development process in any way? Thanks :)
     
  27. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,272
    Hi @N3M3SIS1, thanks for your interest. Our asset allows doing in-app purchases, i.e. buying virtual products only. It does not allow money exchange between PayPal users directly, which is very different in terms of server validation and that would be done best solely over the native PayPal SDK.
     
  28. Nadan

    Nadan

    Joined:
    Jan 20, 2013
    Posts:
    330
    Hi Baroni,

    I'm trying Unity's new distribution platform feature. Do you have any instructions how I could make the IAP work using Simple In-App Purchase System and UPD?
     
  29. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,272
    Hi @Nadan, I haven't tried it out yet since the product page still lists it as beta. What instructions are you looking for e.g. what issues are you experiencing?
     
  30. Nadan

    Nadan

    Joined:
    Jan 20, 2013
    Posts:
    330
    I will get back to UDP since I have new problem.

    I added SIS to my new game, the game has 2 products and the 3rd is restore button. When I try the shop on the Unity editor everything is ok. I have added the products on the Google Play Console/App Store and the fetch is enabled. Unity IAP status is Service Enabled OK, Plugin Imported OK and Package Imported OK.

    But when I uploaded the game to Google Play the game only shows 1 product and the Restore button. Right now I'm making iOS version and when I build the game on device it has the same issue.

    I noticed that the Unity console reads:

    UnityIAP Version: 1.22.0
    Using configuration builder objects
    UnityIAP: Promo interface is available for 2 items

    I have no idea what this means, but could that have something to do with the problem?

    I tried downloading the latest version of SIS on the Asset Store and I'm not really sure what is causing this. Do you have any clue?
     
  31. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,272
    @Nadan it would be great if we could have the UDP conversation on our dedicated support forum, so it is easier for others to comment later on, but also all other issues - I would like to have them in one place, with good search functionality.
     
  32. Nadan

    Nadan

    Joined:
    Jan 20, 2013
    Posts:
    330
    OK, thanks for the info. I added the question to your forum.
     
  33. Ony

    Ony

    Joined:
    Apr 26, 2009
    Posts:
    1,833
    I was looking for the docs but they don't seem available, so I'll ask here. For the record, I make Windows and Mac standalone desktop games, not mobile.

    Am I able to edit the source (if needed) or is it contained in DLLs? Is it possible to add my own virtual currency? Is it possible for me to add itch.io (or other stores) purchasing ability? Can new products be added from outside the system via database access, or do I need to do this in the Unity Editor?

    Thanks!
     
    Last edited: Jun 26, 2019
    JBR-games likes this.
  34. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,272
    Hey @Ony, a pleasure to read you here :)

    A pdf documentation explaining the asset structure is only included inside the package. The scripting documentation is available online (link in first post), as well as several guides on our website forum, in a preview mode with code and images restricted to members.

    For standalone games we currently offer PayPal and Steam payments, besides the typical Unity IAP stores (Windows and OSX App Store). You'll have full, well documented source code available in SIS.

    By "own virtual currency", do you mean you already have one? For buying virtual products with virtual currency, Simple IAP System only "understands" currencies managed by itself, so you will either keep your currency in sync with SIS (not recommended) or migrate it to SIS' internal database.

    Itch.io: we are using Unity IAPs interfaces for adding new stores, which we also used for Steam and Oculus for example. So if itch.io provides methods similar to other stores (a Unity SDK in the best case) then you'll be able to do that.

    Adding completely new products remotely is not something working out of the box, since you would want to define what happens with the product on purchase via code too - and that code would need to be defined in the editor first. What you could do is to add products in the editor, but hidden in stores, so that you can make them visible at a later point in time e.g. via a server config. We are currently offering our PlayFab integration for this which allows modifying titles, descriptions or prices (for sales) remotely.
     
    JBR-games likes this.
  35. Ony

    Ony

    Joined:
    Apr 26, 2009
    Posts:
    1,833
    Ok, thank you for the details.

    We released a game about ten years ago which is still going strong. It uses a virtual currency we created. As I'm currently working on a new version of the game, and looking at possible in-game store solutions. I'll likely roll my own again as nothing else seems to be what I'm looking for right now without a lot of extra overhead.

    Apologies for missing the link in the first post as I came straight to the end here first. Just went to check it out and it's not really the type of docs I'm looking for, but yes I see it there. As far as examples in your forum, I did try that first, but search only works there if I have an account, and it's the same for most of the stickied posts, which are mostly filled with "members only" sections. When I tried to make an account on the forum it required an invoice number, so unfortunately I was unable to do my own research.

    Again, though, thanks for your thoughts. :)
     
  36. javierfed

    javierfed

    Joined:
    Apr 10, 2015
    Posts:
    20
    I have seen some code snippets where you are adding products to the catalog via code. is this something that can be scaled to all products? lets say we are selling magazines that we continually develop, would it be possible to add new magazines to the collection via a database or something?
     
  37. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,272
    Hi @javierfed,

    I've answered a similar question on our forums in more detail, here. What it comes down to is that you cannot add new in app products server side only, since the app needs to know what to do with them on purchase.

    If you're "only" looking at content, then that's not really integrated with in app purchases. E.g. for magazines you could provide them in AssetBundles, and unlock them if your user has a subscription or owns a specific product. This way you could add content to the existing AssetBundle without affecting in app purchases or requiring new in app products.
     
  38. javierfed

    javierfed

    Joined:
    Apr 10, 2015
    Posts:
    20
    lets say I have code that can work out what to do as long as the product ID. we are making a story based game and want to sell the stories individually. I want to have the stories bundled together and tagged with their store ids in a database. if the IAP could load a manifest or something of valid ids, I can programmatically decide what to do on purchase... or is there another way to pull this off, where their purchase history can be used for restoring their story purchases later if need be...
     
  39. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,272
    @javierfed
    You can delay IAP initialization until your app has received an array with all valid product ids from your server, for example. Adding products to SIS at runtime is not the issue, if you figure out what to with them later on.

    If you own Simple IAP System and would like support on this, please keep it to our dedicated support forum.
     
  40. javierfed

    javierfed

    Joined:
    Apr 10, 2015
    Posts:
    20
    ah. ok.. I was unaware of the support forum. can you please provide a link? I do own a licence.
     
  41. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,272
    A link is in the first post, at the top ;)
     
  42. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,272
    v4.3.1 is live on the Asset Store:
    • added checkbox on the IAPManager to allow for manual initialization
    • added fetching product data and price from PlayFab on PayPal & Steam
    • fixed missing API error on PlayFab's JSONWrapper replacement
    • fixed granting currency locally too when using PlayFab Bundles
    • fixed PayPal internal order ID could go lost when switching scenes
    • fixed ignoring Unity IAP fake data on shop items when in test mode
     
    JBR-games likes this.
  43. NAKAS

    NAKAS

    Joined:
    Jan 16, 2013
    Posts:
    21
    Hey I'm interested in this asset and curious about it's local and server-side receipt validation. Currently, we are using unity native iap and the cross-platform validator to validate receipts locally. The problem that we are running into is in our next update for our app we are using cloud features ideally need a way for users to be able to verify receipts for platforms that they are currently not on. I.E an android user buys an in app purchase on android, we store the receipt in the cloud and if they log in to a different device, Mac or IOS we the pull the android receipt down and then use it to verify if the subscription or nonconsumable purchase is valid and unlockable on their non android device. Is this something that possible with either the local or server side receipt verification that you have? Thanks
     
  44. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,272
    Hi @NAKAS,

    our server side receipt validation sends the local receipt to your server, and then to the App Store servers. This is sufficient for regular purchases and subscriptions. You could add your own custom database / user management system to your server, but this is not something we could cover in our implementation.

    That's why we've added PlayFab receipt validation as well. PlayFab offers user accounts and login systems already, where multiple different devices could be linked to the same account. A receipt cannot be sent twice, nor from a different device as then the device identifier / request token would not match. You definitely want to look into some sort of account system for this, using PlayFab or not.
     
    NAKAS likes this.
  45. NAKAS

    NAKAS

    Joined:
    Jan 16, 2013
    Posts:
    21
    Ok, we are currently handling login and accounts with firebase. So you are saying if a user has an android subscription receipt and then logs into their firebase account on an iOS device or Mac computer, and then we fetch their android subscription and send it to PlayFab for validation on iOS or Mac it would not work because the "device identifier / request token would not match."

    Is this our only solution or would the PlayFab example work for this? https://github.com/voltrue2/in-app-purchase

    Thanks!
     
  46. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,272
    @NAKAS I'm saying that it is not best practice to validate receipts multiple times, which does not even work with PlayFab. You would login the user with an account that can be used across different devices, which store the products for that user, so you don't have to re-validate any receipts at all.