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. Nadan

    Nadan

    Joined:
    Jan 20, 2013
    Posts:
    341
    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:
    3,264
    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:
    199
    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:
    3,264
    @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,260
    Hi, Is there a method for unlocking everything via an IAP? Thanks
     
  6. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,264
    @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,260
    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:
    3,264
    @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,260
    Perfect, thanks
     
  10. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,264
    @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.
  11. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,264
    @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.
     
  12. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    2,260
    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
     
  13. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,264
  14. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    2,260
  15. derkoi

    derkoi

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

    Baroni

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

    Chaz32621

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

    Chaz32621

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

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,264
    Could you please elaborate? What recipient? Which validation?
     
  20. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,264
  21. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,264
    @SupremeEnchanter Please contact us via email with your Unity invoice number if you're having issues registering on our support forum.
     
  22. 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 :)
     
  23. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,264
    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.
     
  24. Nadan

    Nadan

    Joined:
    Jan 20, 2013
    Posts:
    341
    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?
     
  25. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,264
    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?
     
  26. Nadan

    Nadan

    Joined:
    Jan 20, 2013
    Posts:
    341
    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?
     
  27. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,264
    @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.
     
  28. Nadan

    Nadan

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

    Ony

    Joined:
    Apr 26, 2009
    Posts:
    1,977
    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.
  30. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,264
    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.
  31. Ony

    Ony

    Joined:
    Apr 26, 2009
    Posts:
    1,977
    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. :)
     
  32. javierfed

    javierfed

    Joined:
    Apr 10, 2015
    Posts:
    50
    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?
     
  33. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,264
    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.
     
  34. javierfed

    javierfed

    Joined:
    Apr 10, 2015
    Posts:
    50
    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...
     
  35. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,264
    @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.
     
  36. javierfed

    javierfed

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

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,264
    A link is in the first post, at the top ;)
     
  38. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,264
    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.
  39. NAKAS

    NAKAS

    Joined:
    Jan 16, 2013
    Posts:
    23
    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
     
  40. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,264
    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.
  41. NAKAS

    NAKAS

    Joined:
    Jan 16, 2013
    Posts:
    23
    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!
     
  42. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,264
    @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.
     
  43. Thiscord

    Thiscord

    Joined:
    Sep 9, 2019
    Posts:
    2
    Hi,
    I'd primarily like toreward the player with in-game currency for watching rewarded video ads. Is this possible using this asset?

    Cheers
     
  44. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,264
    Sure @Thiscord. It is your decision when to grant in-game currency. You would want to add a call to our database manager (DBManager class) when your video ad completes.
     
  45. Harrishun

    Harrishun

    Joined:
    Apr 13, 2016
    Posts:
    59
    Hi @Baroni, I am currently looking at your Simple IAP System for (what I believe to be) similar reasons as @NAKAS, above. I just wanted to clarify the scope of your asset. My main problem that I'm trying to solve is a specific edge case where if a user purchases a subscription on Android, and then later moves to an iOS device (or vice-versa), we need to be able to find whether or not the subscription has renewed when the renewal date has passed. However currently it seems as if the user would need to log back into the app with the Android device (which may not be possible for a number of reasons). Is there a way around this using your asset?
    You did mention here that this type of system is not covered by your asset, which is what I've been thinking I'll need to implement, so I'm pretty sure it's a "no," but I thought I'd ask anyway! I was also envisioning such a system would store the receipt from the user's device when they purchase the subscription, and then we could set up a script on the server (or a cron job?) to check whether that receipt's next renewal date has been updated, but you said it's best practice not to re-validate receipts, so I'm not sure if that would sort of system would be the best solution now.

    Hope to hear back soon. :)
     
    Last edited: Nov 11, 2019
  46. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,264
    Hi @Harrishun, I am curious to know how you would link the Android user to iOS? In your example, if the user buys a product on Android and then switches to an iOS device, how would you know that it's the same user?

    Our server-side receipt validation is able to check for expired subscriptions on app launch - per App Store account. If you would like to support cross platform accounts, as I wrote above, I would recommend a true cross platform login system e.g. via Facebook or email & password. In this scenario you would link the products to that account, and it would not matter from which device your users are logging in, as long as they are using the same credentials. We have to draw a line somewhere, so a custom user management system is not part of our asset. Unfortunately, PlayFab does not support subscriptions at this time either.

    You could do that for auto-renewing subscriptions, but save the expiration date as well so your job knows exactly which receipts are about to expire, without the need to verify all of them every day.
    For user-initiated subscription renewals, it would be easier to only save the expiration date: when a user completes a subscription purchase, parse the receipt and save the expiration date. When the user logs in after this date, simply remove the product before returning its inventory. A manual subscription renewal causes a new receipt, so you'll get a new expiration date each time. It depends on which type of subscriptions you are using.
     
    Harrishun likes this.
  47. Harrishun

    Harrishun

    Joined:
    Apr 13, 2016
    Posts:
    59
    Thanks for your quick response Baroni.
    We have email and password login via Firebase. On our database we store the user's subscription details, so whether they login from iOS or Android, they log into the same account. A member of our team has actually seen this work successfully for a (non-Unity) mobile app, where he continued to pay for his subscription via Google Play, but had switched over to an iOS device. The app had accounts and that's where the link was, so we knew it was somehow possible, but as time is a factor right now, we were wondering if there was a suitable asset out there.
    Ah, alright then. Thanks for the clarification! I assumed that's what we would have to do. The main unknown right now is the implementation of saving the receipts somewhere on the server, and then continuing to verify the subscription using that receipt, but it's always good to have an idea of what your unknowns are. :D
    We're currently saving the expiration date (along with a few other details), so hopefully this should be relatively easy to do. We specifically only use auto-renewing subscriptions.

    Really appreciate your help here, thank you again!
     
    Baroni likes this.
  48. justtime

    justtime

    Joined:
    Oct 6, 2013
    Posts:
    424
    Hi there! Does your DBManager support cache system for player prefs like this one? I am asking because i need to use values from player prefs in cycle(and read and write a lot) with good performance.
     
  49. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,264
    Hi @justtime, our DBManager saves values at the moment when you call it. For better performance, you would keep your values in a local variable and pass it to the DBManager at the end of the game/round. That's best practice and what I recommend for the most types of games.
     
    justtime likes this.
  50. justtime

    justtime

    Joined:
    Oct 6, 2013
    Posts:
    424
    Hi! Will this plugin solve unity iap issues? Or it just a wrapper and will inherit all problems, related to unity iap?
    I mean, i have a bugs iap such as purchasing system init errors, and process purchases errors, like when user buy a product, but i got USER_CANCELLED error, and so on.