Search Unity

  1. The 2022.1 beta is now available for testing. To find out what's new, have a look at our 2022.1 beta blog post.
    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

    107 vote(s)
    85.6%
  2. Voxel Busters

    6 vote(s)
    4.8%
  3. Stans Assets

    11 vote(s)
    8.8%
  4. Prime31

    1 vote(s)
    0.8%
  1. AppSD

    AppSD

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

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,531
    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:
    5
    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,531
    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,531
    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:
    5
    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:
    5
    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,531
    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:
    3
    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,531
    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:
    3
    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,531
    @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:
    3
    That worked! Thank you.
     
    Baroni likes this.
  19. Kapteeni-Studios

    Kapteeni-Studios

    Joined:
    Apr 5, 2014
    Posts:
    35
    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 at 3:07 PM
  20. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,531
    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:
    35
    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,531
    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:
    17
    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,531
    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:
    17
    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,531
    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:
    17
    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,531
    That's correct, there is no need for a restore button on Google Play.
     
  29. ishangill

    ishangill

    Joined:
    Nov 28, 2017
    Posts:
    17
    Thanks . for response.
     
    Baroni likes this.
unityunity