Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice

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

    131 vote(s)
    85.1%
  2. Voxel Busters

    8 vote(s)
    5.2%
  3. Stans Assets

    13 vote(s)
    8.4%
  4. Prime31

    2 vote(s)
    1.3%
  1. AppSD

    AppSD

    Joined:
    Feb 9, 2021
    Posts:
    11
    I would be very interested.
     
  2. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,775
    Great! For Simple IAP System users, there will also be a coupon to add a month or two for free. I'll put you on my list.
     
  3. Gathering_Storm_Studio

    Gathering_Storm_Studio

    Joined:
    May 30, 2018
    Posts:
    8
    I have sent you a video of the issue in a private conversation
     
  4. AppSD

    AppSD

    Joined:
    Feb 9, 2021
    Posts:
    11
    I have not received it.
     
  5. mgazisalik

    mgazisalik

    Joined:
    Jan 19, 2019
    Posts:
    16
    The previous version had a backend for auto-renewing subscriptions. So, is the backend mandatory for auto-renewing subscriptions in the new package?
     
    justtime likes this.
  6. bananadev_

    bananadev_

    Joined:
    Nov 6, 2018
    Posts:
    6
    Hey!
    Firstly thanks for the asset, I bought it today and I'm just having some issues :)

    I am using it to integrate the steam economy using the Steam inventory service.
    The issue is that nothing happens when I click the purchase button (no logs or errors in development build) and the steam purchase overlay does not appear (only shift-tab overlay appears)

    This is in a blank project with the asset, latest version of Unity IAP, Unity UI and using my published steam app for the backend.

    Here are my settings in Unity:

    For testing purposes I only have one product, the prices do not sync with steam



    Item definitions in steam

    Code (JavaScript):
    1. {
    2.   "appid": "1190150",
    3.   "itemdefid": "100",
    4.   "Timestamp": "2021-12-16T09:15:23Z",
    5.   "modified": "20211216T091523Z",
    6.   "date_created": "20211216T091407Z",
    7.   "type": "item",
    8.   "display_type": "",
    9.   "name": "Hat decoration",
    10.   "price": "1;VLV100",
    11.   "quantity": 0,
    12.   "description": "Hat decoration description",
    13.   "background_color": "3C352E",
    14.   "icon_url": "http://cdn.beta.steampowered.com/apps/440/icons/c_fireaxe_pyro_xmas_large.fa878752e1aa09a721a03042a234063b6c929278.png",
    15.   "icon_url_large": "http://cdn.beta.steampowered.com/apps/440/icons/c_fireaxe_pyro_xmas_large.fa878752e1aa09a721a03042a234063b6c929278.png",
    16.   "name_color": "7D6D00",
    17.   "tradable": true,
    18.   "marketable": true,
    19.   "commodity": false,
    20.   "item_slot": "decoration",
    21.   "item_quality": "0"
    22. }
    All settings in Economy page are also filled with the correct keys, Application set to 'game' and inventory turned on.

    Thanks so much for the help in advance!
    Alex :)
     
  7. UDN_ca1e1ac2-916b-4724-8bd5-5b0c263012cc

    UDN_ca1e1ac2-916b-4724-8bd5-5b0c263012cc

    Joined:
    Jan 9, 2017
    Posts:
    2
    I have question about implementing a subscription.

    ・When I call restore, it doesn't work. What is the cause?

    ・Will it be automatically renewed when it expires?
     
  8. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,775
    I am so sorry for missing the previous questions! For whatever reason, I did not get email notifications for them, but just noticed a new post. Sorry again for any inconvenience caused!
    ---

    SIS1 came with a php script that validated each receipt at the time of purchase and app launch. It required your own server and made quite a lot of requests. The expiration or status change of subscriptions still cannot be detected automatically by Unity IAP or SIS, as the receipts always need to be validated to retrieve their current state. Meaning a backend is still required. For SIS2 I worked on a receipt validation service that handles subscription expiration and refunds/billing retry/grace periods (so even more features) without requiring your own server. It can be found here and will transition into beta soon.

    ---
    @bananadev_ also sorry to you personally for leaving your question unanswered for more than a week! That's definitely not a regular response time.
    Thank you for the screenshots, your settings actually look good! The only thing I notice is that the override settings are not needed, since overriding the global ID 100 with a local ID 100 would not have any effect. When you start the app on Steam, do you see the correct name in the overlay, to verify that the app is correctly linked with Steam? Also, did you make sure to login with your developer account, and have you tried retrieving the currently logged in user name via Steamworks e.g. using SteamFriends.GetPersonaName() (and checking SteamManager.Initialized) as mentioned on the Getting Started docs? It would help to identify whether there's an issue with initializing Steam correctly.

    ---
    1. Could you clarify what method you are calling and on what platform? On Google Play, restore is called automatically when installing the app. It does not have any effect otherwise. On Apple, it prompts for a password and should then restore the owned products correctly. Is this with a non-renewing or auto-renewing subscription?
    2. Yes, but that's handled on the App Store. SIS does not know when a subscription renews or even when it expires, as you need to re-validate the receipt again to retrieve the current subscription status. As mentioned above, the Receipt Validator service I am working on will solve this problem, in addition to other security features.
     
  9. UDN_ca1e1ac2-916b-4724-8bd5-5b0c263012cc

    UDN_ca1e1ac2-916b-4724-8bd5-5b0c263012cc

    Joined:
    Jan 9, 2017
    Posts:
    2
    Thank you for your reply.
    I'm trying out a non-renewable subscription to AppleStore.
    Consider the Receipt Validator service.

    Can I still check my subscription status and expiration date when I use the SubscriptionManager in Unity IAP?
     
  10. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,775
    For a non-renewing subscription, you can. However be aware that Unity IAP does not consistently save product receipts between app restarts, meaning they could be lost and require a "restore" from the user. You might want to save the latest product receipt on the device yourself. Also, note that local receipt validation does not protect you e.g. against device clock changes.
     
  11. bananadev_

    bananadev_

    Joined:
    Nov 6, 2018
    Posts:
    6
    Thank you! I've removed the overrides.

    There is no issue with initialising steam, here is a development build with the correct game name and also in the corner I made a test button that calls SteamFriends.GetPersonaName() and Debug.LogErrors it (so it shows up in the development build console).
    I implemented the SteamManager.Initialised check too, as mentioned in the docs. When launching out of steam, it quits and reopens in steam as it should :)

    Still, the implementation does not work.
    Any ideas?

    Thanks,
    Alex :)


     
  12. bananadev_

    bananadev_

    Joined:
    Nov 6, 2018
    Posts:
    6
    Is there any chance I could send you my project files so we could more easily look into this further?
     
  13. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,775
    Thanks for the follow-up Alex (@bananadev_), with the SteamFriends.GetPersonaName() result printing correctly, the Steam connection seems to be working indeed.

    I noticed that in the IAP Settings, you entered "1.99" for the price, but in the app it displays "1" as set in the Steam Item definition. If you did not change that, it looks like the app is receiving at least the price information.

    To further debug this, you could place more Debug.LogError calls in the SteamStore.cs script at different places, starting with the Purchase() method which should be invoked on the button click. If it is not called at all, try moving backwards to the initialization methods.

    Regarding the project files, you could upload them somewhere and send me a private message with the link. However, I would not be able to build and run the app at all, since I would need to be logged in with your developer account.
     
  14. Neion85

    Neion85

    Joined:
    Nov 24, 2020
    Posts:
    14
    I have just bought the simple IAP 2 system. I followed the steps for integration and upon download of the Unity IAP system, I get the following error:

    Assets\SimpleIAPSystem\Scripts\ReceiptValidatorClient.cs(18,30): error CS0234: The type or namespace name 'Security' does not exist in the namespace 'UnityEngine.Purchasing' (are you missing an assembly reference?)

    I am using unity version 2019.4.21f1. How do I resolve this issue?
     
  15. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,775
    Thanks for posting here. The error comes from Unity IAP not being installed / unpacked correctly, i.e. installing it while having other script errors in the project.

    To solve this, either delete the Purchasing package and start over again, but clear other errors before doing so. Or, check the Packages > In App Purchasing folder for a "Unity IAP" unitypackage and double click it to unpack manually.
     
  16. Neion85

    Neion85

    Joined:
    Nov 24, 2020
    Posts:
    14
    I have tried what you said and it did not work. I even started a new project to test, and the same problem persisted.
     

    Attached Files:

  17. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,775
    @Neion85 Unity IAP 2.2.2 is a year old, you have to expand the little arrow in the Package Manager and install the latest one, Unity IAP 4.1.2.
     
  18. Neion85

    Neion85

    Joined:
    Nov 24, 2020
    Posts:
    14
    That worked! Thank you.
     
    Baroni likes this.
  19. Kapteeni-Studios

    Kapteeni-Studios

    Joined:
    Apr 5, 2014
    Posts:
    38
    Hi Baroni,

    I have being using this code and it has worked.

    There are still many refunds and I just received this message from player:

    "Was wondering why the purchases i made through this game are being refunded, when i have not requested them to be. I never had this happen before on any other app. This is a first for me. Hoping someone can explain what is going on."

    This could explain why my game has so many refunds. But why is this happening? Have you heard about any issues with refunds happening without requests in Google Play?

    Unity Forums has a topic about the issue, but I don't understand any of this since I use SIS2 that handles everything

    https://forum.unity.com/threads/google-payments-are-being-automatically-refunded.1033057/

    I've noticed before when I do purchase with test account, my purchase is being automatically refunded in 5 minutes. I though this was just because it was test a purchase, but this could be caused by the same issue.

    Here it reads:

    "If you use the Google Play Billing Library version 2.0 or newer, you must acknowledge all purchases within three days. Failure to properly acknowledge purchases results in those purchases being refunded."

    https://stackoverflow.com/questions/61303150/google-in-app-purchase-are-always-refunded

    But what does the "you must acknowledge all purchases within three days" mean?
     
    Last edited: Jan 12, 2022
  20. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,775
    Hi @Kapteeni-Studios,

    refunds are handled by Google only. Simple IAP System does not interact with the store directly to request or deny refunds, but Unity IAP does.

    Currently you are the only one reporting this, so it could be a different issue within your app. Acknowledging purchases means calling ConfirmPendingPurchase on Unity IAP's StoreController, which always happens automatically at the end of the IAPManager ProcessPurchase implementation, except you are using any sort of external receipt validation or deferred purchases.

    In case of deferred purchases, the method is invoked again by Unity IAP when the pending state clears up and potential payment issues were solved by the user.

    I can only imagine issues in this workflow if you are somewhere running into an exception in your code, or otherwise not being able to confirm the pending transaction. You may want to put some Debug.Logs in the ProcessPurchase method to verify.
     
  21. Kapteeni-Studios

    Kapteeni-Studios

    Joined:
    Apr 5, 2014
    Posts:
    38
    Right now I have no idea how to fix this. I try to find something with Debug.Logs. I don't understand why everything has worked before and not anymore. I've just installed Unity IAP and SIS2. Maybe I should redo the store for the game (just install SIS etc.) and hope it works.

    But, in general, when you do a test purchase it should not be automatically refunded in 5 mins right? This way I could at least test this. Make a test scene in the game where I could try to test purchase one item and see if it gets refunded in 5min or not.

    With the customer's refunds it's always the same, after 72 hours it refunds. It's so strange that this happens to about 40% of the purchases and not all.

    Example:

    9 Jan 2022 13:22:54 UTC
    Payment pending
    Order received

    9 Jan 2022
    13:22:56 UTC
    Chargeable
    The customer's form of payment was authorized for USD 4.76 and passed all risk checks

    9 Jan 2022
    13:27:57 UTC
    Charged
    The customer's form of payment was successfully charged for USD 4.76

    12 Jan 2022
    13:32:57 UTC
    Processing refund
    A refund of USD 4.76 was initiated.

    12 Jan 2022
    13:37:57 UTC
    Refunded
    The user was refunded USD 4.76
     
  22. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,775
    Correct, using SIS or even basic Unity IAP samples the product should not be refunded, regardless of using a sandbox test user or not. E.g. non-consumable products on testers stay purchased until you explicitly hit the refund & revoke button in the Google Dev Console, that's how I am testing multiple product purchases (on non-consumables).
     
  23. ishangill

    ishangill

    Joined:
    Nov 28, 2017
    Posts:
    22
    Hello sir.
    I need some help .
    I has enable the encrypt in IAP manager. But i don't know what type of key i have to paste in (obfusc key).
    And what is ( Memory only ) .
    Simply after enable the encrypt , when i press the play button then this errors is shown in console.(I attached the image)
    And How can i use restore button.
     

    Attached Files:

  24. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,775
    Hi @ishangill,

    regarding "obfuscKey" and "memoryOnly" the scripting reference has an explanation which should clear things up. Every public variable is described there. Your obfuscKey is either not exactly 8 characters long or has special characters. Let me know if something is still unclear.

    What exactly do you mean? You would just add a button that calls the RestoreTransactions method on the IAPManager. The UIButtonRestore script is an implementation for this and can be attached to a UI button.
     
  25. ishangill

    ishangill

    Joined:
    Nov 28, 2017
    Posts:
    22
    Hello sir.
    Thanks for response.
    I am not using any cloud system with Simple IAP.
    I am testing encryption in my test project , not in my real game project.
    Simply i enable the encrypt and (Memory only is default disabled) and set the Obfusc key (12345678). And when i test , then everything works properly and save file in local storage is successfully encrypted.
    But
    Restore Button :
    Restore button prefab is automatic disabled in runtime when i click the play button.
     
  26. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,775
    The script automatically disables itself on platforms not supporting or requiring a restore button. It's in the UIButtonRestore code. Specifically, a restore button is only required on IOS. On other platforms including Google Play, the restore flow is automatically invoked when installing the app. Also, in the Unity Editor there are no transactions or restore.

    You can read more about that on the official Unity IAP documentation.
     
  27. ishangill

    ishangill

    Joined:
    Nov 28, 2017
    Posts:
    22
    Hello Thanks For response.
    It means no need to do anything to restore for Google play store.
    If someone has Uninstall the app and again reinstall, then purchases will automatically restored or not.
     
  28. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,775
    That's correct, there is no need for a restore button on Google Play.
     
  29. ishangill

    ishangill

    Joined:
    Nov 28, 2017
    Posts:
    22
    Thanks . for response.
     
    Baroni likes this.
  30. Neion85

    Neion85

    Joined:
    Nov 24, 2020
    Posts:
    14
    Hi Baroni,

    I have followed your integration tutorials on your website for PlayFab Integration & PayPal (via PlayFab).

    When I try to purchase in the cash shop, it gives the following message: "Custom Store PayPal is not enabled!

    I enabled the custom store, put in the sandbox client ID and sandbox secret, and attempt to purchase again. This time I get the following message: 'Signature Invalid".

    Is there anything I have done wrongly?
     
  31. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,775
    Hi @Neion85,

    I assume that on your category or products, you have set "Billing Provider" = PayPal in the Overrides tab. This is for the native PayPal implementation, not for PlayFab PayPal. Specifically, when using PlayFab PayPal, nothing should be done from the native PayPal guide. So, you would not enable PayPal in the Overrides tab and not enable it in the Custom Stores section.

    When using PlayFab PayPal, every purchase goes over the PlayFab servers (all or nothing), meaning you cannot select individual products to pay with PayPal and others with Google Play, for example.
     
  32. Neion85

    Neion85

    Joined:
    Nov 24, 2020
    Posts:
    14
    Hi @Baroni,

    I removed the billing provider PayPal in the overrides tab. When I click on the item to purchase now, it just unlocks immediately instead of going to the payment screen even though I have done the integration.

    I think I am still missing some steps, have gone over the website integration again, nothing seems to be omitted. I have added PlayFab as third party service provider, but there is no difference whether I put PlayFab or none.
     
  33. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,775
    That happens if you try to purchase something in the Unity editor, in test mode, which is only available for native payments (Google Play, iOS etc.). Which would mean that your payment still gets routed through the wrong provider and not PlayFab PayPal. In the Setup tab > Unity IAP > Store Implementation section, did you also choose PlayFab PayPal in the dropdown for your current platform?
     
  34. Neion85

    Neion85

    Joined:
    Nov 24, 2020
    Posts:
    14
    Hi @Baroni,

    I have selected PlayFab PayPal for both WebGL and Standalone, the message I get now is "Billing is not available."

    I am using a standalone store implementation.
     
  35. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,775
    We're getting there. Any errors in the Console? Did you start from the UserLogin scene which contains the PlayFabManager prefab?
     
  36. Neion85

    Neion85

    Joined:
    Nov 24, 2020
    Posts:
    14
    upload_2022-1-20_19-23-7.png

    These are the errors I have. I started from UserLogin scene.
     
  37. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,775
    Thanks for the screenshot. These IAPManager settings are not from the UserLogin scene, please compare - "Auto Initialize" needs to be off, since the PlayFabManager initializes the IAPManager when the PlayFab connection is ready and products were downloaded. Also, "Memory Only" has to be on, since no user data will get saved on the device, only retrieved from PlayFab after login.

    Additional hint: do not have multiple IAPManager & PlayFabManager prefabs in your scenes, only in the first one. They persist across scenes automatically.
     
  38. Neion85

    Neion85

    Joined:
    Nov 24, 2020
    Posts:
    14
    Hi @Baroni,

    upload_2022-1-20_19-48-6.png

    I have changed the settings but I am still getting the same errors. I only have one IAP Manager & PlayFab Manager prefab in the first scene, the store is also in the first scene.
     
  39. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,775
    Well there is one error less than in your last screenshot :) I'm a bit confused why the "Unity IAP is not initialized" error comes without the login message, something like "Got PlayFabID: xxx (existing account)". Do you try to purchase a product without logging in prior to that? Or did you just disable Debug.Log messages in the Console?
     
  40. Neion85

    Neion85

    Joined:
    Nov 24, 2020
    Posts:
    14
    Hi @ Baroni,

    The debug.log doesn't appear for my scripts, I am not sure how to enable it. I did login before I try to purchase, I am at a loss too. I have no idea why it is not working.
     
  41. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,775
    @Neion85 in the Console, if you scroll to the right and in the top right corner, you can toggle warnings/errors/debug messages. Maybe you've disabled it there.

    We basically went through all settings required... I would suggest trying it out in a new project with SIS + PlayFab set up again. If you fail there, you could upload it and send the link in a private message, for me to replace your keys with mine and reproduce.

    P.S. check the CURL error too though, maybe it is coming from an unsuccessful PlayFab login (I am not able to verify).
     
  42. MaxLerner

    MaxLerner

    Joined:
    Jan 18, 2016
    Posts:
    6
    Worked fine on PC when build to android got this error Screenshot_20220120-151051_Treat.jpg
     
  43. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,775
    Running in the Unity Editor is using test mode, it will always work. There are no receipts or store connections in the Unity editor. Please check the Unsolved Errors section in the guide for Google Play, there is no way for me to know the exact cause for this error on your end.
     
    MaxLerner likes this.
  44. MaxLerner

    MaxLerner

    Joined:
    Jan 18, 2016
    Posts:
    6
    unavailable product can it be the error cause?
    Capture2.JPG
     
  45. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,775
    One unavailable product will not be the cause. However, if there are no products available at all and Unity IAP prints the following log messages, then that's definitely a reason for the "Billing is not available" message.

    Code (csharp):
    1. UnityIAP:Requesting product data...
    2. UnityIAP:Received 0 products
     
    MaxLerner likes this.
  46. SoerenL

    SoerenL

    Joined:
    Mar 24, 2014
    Posts:
    17
    I'd like to rename a product, but I assume that I can't do that without users that have already bought it, losing access to it. Am I right in that assumption ?

    If I'm right in the above assumption: what I want to do is 2 things:

    1. hide the old product.
    2. in case the user has purchased the old product: mark the new product as purchased.

    You've previously explained to me how to hide a product from the store. How do I mark a product as purchased please ?

    Many thanks in advance!

    Edit: just to clarify: Ideally I want to just change the Display Name and Description of a product. If the product ID doesn't change and the users never see the product ID, then that shouldn't be a problem. Is that possible without the workaround I describe above please ?
     
    Last edited: Jan 22, 2022
  47. SoerenL

    SoerenL

    Joined:
    Mar 24, 2014
    Posts:
    17
    Also.. currently upgrading from Unity 2019 to 2020. The products get listed but price is not shown, and nothing happens if I try and purchase them. Can I expect SIAP 1 4.3.7 to work with Unity IAP 3.0.1 (from Package Manager) ? or do I need to upgrade to SIAP 2 ? If I update to SIAP 2, can I reuse a shop scene based on SIAP 1, or will I have to redo a shop scene ?
     
  48. Neion85

    Neion85

    Joined:
    Nov 24, 2020
    Posts:
    14
    @Baroni everything worked fine when I created a new project. I realized where the real problem lie, your asset contained its own menu code and playfab manager, I had a working login system with my own playfab manager.

    To fix the problem, I will need to integrate my playfab manager and menu functions with your inbuilt menu and playfab manager.
     
    Last edited: Jan 24, 2022
    Baroni likes this.
  49. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,775
    If you change the product identifier, current customers will still have access to the old product if the purchase state was saved locally. However they will not be able to restore it later or on a different device, which would be a reason for your app to be rejected/removed. I advise not changing product identifiers in a production app.

    Just for completeness sake, please see the scripting reference on the DBManager component (SetPurchase method). There is also a similar method for SIS 4.

    SIS 4.3.7 received a final update for Unity IAP 3.x, but 3.0.1 is nearly a year old. At least you would want to update to 3.2.3 (half a year old) and try again. Please not that support for SIS 4.x ended so I will not be able to investigate further.

    SIS 2 is a major upgrade (reflected by the Asset Store upgrade path). As such, SIS 1 shop scenes are not compatible with SIS 2. Since the components and structure of instantiating products in the shop scene changed, you will have to modify a SIS 1 shop scene to make it compatible with SIS 2.
     
    SoerenL likes this.
  50. SoerenL

    SoerenL

    Joined:
    Mar 24, 2014
    Posts:
    17
    Do I understand you correctly: it is safe to change the Title and Description of a product, even if users have already bought it. It is only the Identifier that would cause problems if changed ?
     
unityunity