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

    salmanjaved5050

    Joined:
    Aug 2, 2015
    Posts:
    8
    So In my use-case we have an in-game wallet and we deduct funds from paypal. Is there a response callback available which tells us how many funds were withdrawn and if it was successful or not. Thanks for quick response though!
     
  2. Delacroz

    Delacroz

    Joined:
    Sep 23, 2019
    Posts:
    13
    Where do you create the paypal link?So that I can try instead of sending the value of an item, I can send all the values of a cart that I'm going to create
     

    Attached Files:

  3. Delacroz

    Delacroz

    Joined:
    Sep 23, 2019
    Posts:
    13
    I'm making a system using webview, the targeting URL can be something like paypalsdk://success ? or does it necessarily need to be a page with htpps?
     
  4. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,261
    Thanks for the clarification! If you purchase a product in-game, you can react to the callback in the IAPListener which receives the product ID, so you would know what exactly was bought - if users are not able to change the amount on the PayPal checkout, of course.

    Otherwise, the redirect URL you specify on Simple IAP System's PayPal settings could be used to direct users to your own server endpoint. There, you could read the user ID and purchase token since it is appended to the url after purchase. You can then check the token for authenticity periodically and grant funds to the user's account. Another option with an own server and user management system would be the PayPal IPN service.

    This should give an idea on possible implementation concepts! I hope you understand that it's a bit difficult to explain here in detail without knowing your exact workflow or requirements.

    The PayPal order is created by sending a purchase request to the PayPal servers. You would look for that in the PayPalStore class too. But please note that if you are trying to modify this, it is not an easy task and requires some knowledge of the PayPal REST API first. I would still recommend using direct checkout for single products, and your own website for a shopping cart.

    The page needs to be a real page.
     
  5. Delacroz

    Delacroz

    Joined:
    Sep 23, 2019
    Posts:
    13
    Where I can edit the ""bought"" message text?
     
  6. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,261
    In the IAPListener script.
     
  7. Delacroz

    Delacroz

    Joined:
    Sep 23, 2019
    Posts:
    13
    Is that some way for paying in PayPal without login?
     
  8. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,261
    You would be looking at guest payments. Not sure if PayPal's documentation is up-to-date though, this has nothing to do with Simple IAP System.
     
  9. Delacroz

    Delacroz

    Joined:
    Sep 23, 2019
    Posts:
    13
    I was trying to do it, but I can't get how... I'm new using paypal, even this having nothing to do with SIS, can you please help me?
     
  10. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,261
    I haven't tried using guest accounts myself yet. Could you explain where you are running into issues? Did you find the setting mentioned in PayPal's documentation? What else have you tried? What would be the expected outcome?
     
  11. marlonpcg

    marlonpcg

    Joined:
    Jul 26, 2017
    Posts:
    1
    Hi Florian, I hope you are well!

    In Webgl when using PlayFab/Paypal, it just doesn't go beyond the line below in IAPManager. I had to add a condition to not load in WEBGL.

    await UnityServices.InitializeAsync();

    When I change the currency in IAP to my country's currency, Playfab sends the RM currency and Playfab sends the USD currency to PAYPAL.

    In PAYPAL, when I disable the conversion, I cannot receive in USD.

    Is there a way to get around this or create a different flow that goes straight to PAYPAL and then release the item on Playfab with CloudScript or Javascript?

    Grateful,
     
  12. danialaddin66

    danialaddin66

    Joined:
    Aug 26, 2019
    Posts:
    7
    Hello! I have configured Simple IAP System and Receipt Validator for purchases on my app on both Windows and Andriod Versions, where the windows works with PayPal and the Android works with GooglePlay, the google play part works more than perfect but when I release for windows, trying to click the purchase button gives me no actions
     
  13. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,261
    Hi @marlonpcg, thanks for posting here!
    Understood, I will try to reproduce and create a bug report with Unity for this.

    I misinterpreted that you are using PayPal with PlayFab, I thought you are using the native PayPal implementation. In this case PlayFab needs to process the PayPal purchase in order to add the item to user inventory. Trying to circumvent this with a native PayPal implementation and then calling CloudScript would not only mean a lot more work (you would need own servers, pass the user ID and item ID bought from PayPal, write the CloudScript) but also a security risk in others potentially calling the CloudScript too.

    There is a related thread on the PlayFab forum too:
    https://community.playfab.com/questions/43565/paypal-integration-change-rm-currency.html

    I'm still not sure why adding a USD balance to your PayPal account would not work out for this. If you are trying to avoid any sanctions by PayPal on your account, you might want to ask them to clarify or for assistance.

    --------------
    Hi @danialaddin66, I am glad to hear everything is working fine on the Receipt Validator with Google Play!
    The Receipt Validator only supports Google Play and Apple App Store, so when using PayPal it is not involved in any way. When preparing the Windows build, did you specify PayPal as billing provider for your product in Simple IAP System? Do you see any errors in the Console when 'Development Build' is enabled?
     
  14. danialaddin66

    danialaddin66

    Joined:
    Aug 26, 2019
    Posts:
    7

    Yes I have chosen PayPal as provider, as well as added PayPal overrides for all product ID's, no errors occured!
    Also I have noticed something else; my payment was working perfectly fine on GooglePlay, but ever since adding the validator it has only worked once, other than that (no changes made) it gives me the same no-action as the windows version does with the PayPal provider (I do uncheck PayPal provider when building for Android)
     
  15. Ryoshu7

    Ryoshu7

    Joined:
    Dec 28, 2021
    Posts:
    4
    Hi,
    I'm currently integrating localization in my game. For the IAP scene, enabling fetch essentially uses the localized item descriptions and prices. Though I'm just wondering what would happen if the player is offline? Would the item's localized title & description be shown with the localized price?
    Also can I use the (offline) localization system I have to show the localized titles/descriptions while just having the localized price from the app stores by enabling fetch?

    By the way, I had the old Simple IAP System in an old project I just got back to. I remember there was a website forum with many questions/answers and a few topics that you pinned. One of them is upgrading to the new version, I tried looking for the Simple IAP forums but I couldn't find them. I'm just wondering if these questions are still there somewhere as it may be useful.

    Lastly, I was wondering if there is a discord server for Simple IAP users?

    Thanks
     
    Last edited: Sep 26, 2022
  16. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,261
    Could you send me your PayPal settings as a screenshot and your PayPal sandbox credentials as text via private message? There isn't really anything else to set up than that, so it is a bit weird that you are not even getting the browser window opened. As for the Google Play issue, you would want to debug the device log directly, the problem description is too vague to help out.

    --------
    Hi there! If the user is offline, Unity IAP might try to initialize with the device cache if the user was online before, and then would still show the localized data. However, most of the time Unity IAP will fail to initialize while being offline and therefore no localized data can be accessed by Simple IAP System either.

    Sure. In the current version, when enabling fetch all assigned Text components (title, description, price) are overwritten as there is no separate setting for them. In the IAPManager script, OverwriteWithFetch method, you would comment out the properties you would not want to be localized. Then you are also free to use your own localization system as you can access all ShopItems in the scene via the IAPManager.shopItems dictionary after they were instantiated (usually one frame after Start).

    Yeah, the forum was shut down earlier last year as it was too much of a hassle to maintain. This thread is now the main place for support. Upgrade notes can always be found in the release notes, for example on version 5.0 and 5.2.

    No, sorry - I tried having one after removing the forum, but unfortunately the Discord server resulted in me answering 1-1 questions the whole day instead of users communicating with each other.
     
  17. Maverickjw

    Maverickjw

    Joined:
    Oct 21, 2020
    Posts:
    6
    Recently bought your Simple IAP System in the asset store, didnt know you made the tank multiplayer as well, got it long ago as well. My game already uses Playfab and has a store UI implemented, also already have the Catalog in Playfab and all Virtual currency paid items are implemented and working. All im missing is to add the RM real money purchasing of coins and bundle chests, why i bought your IAP, to guide me a little.

    At start im trying to setup the Paypal option. Created the developer account in paypal and installed the add-on in playfab. Explored your code a little as well and when calling PayForPurchase, on success purchase i call the Application.OpenURL(result.PurchaseConfirmationPageURL) and takes me to paypal web page, with the amount to pay; but when i click buy, paypal stays processing the payment, even charges the amount from my account, but stays there, processing eternally.
    I think i need the paypal callback to finish processing and sending me back to the game and call playfab confirmPurchase method, but dont know how, reason i thought your IAP System would help to guide me.

    Been trying to find your support email but couldnt find it, so this is the only way i contact you.
     
  18. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,261
    Hi @Maverickjw, thanks for cross-buying my assets :)

    Simple IAP System has the UIWindowConfirm component for that - after completing PayPal payment, it opens a window that lets you confirm the purchase. Internally this routes to the PlayFabPayPalStore.ConfirmPurchase() method. I hope this guides you in the right direction!

    I don't do support via email, each asset has a support thread here and this is the correct place to ask.
     
  19. Sciberus

    Sciberus

    Joined:
    Jun 11, 2018
    Posts:
    1
    is it possible to update from v4.3 to version 5.2.1 and keep our Database and settings?
     
  20. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,261
    Yes, please see the upgrade notes on the release notes page on version 5.0 and 5.2. You can mostly preserve your product settings by doing the JSON export+import, however you would need to define product rewards and costs again as these field were introduced in the later versions. Other component changes are mentioned in the upgrade notes.
     
  21. Maverickjw

    Maverickjw

    Joined:
    Oct 21, 2020
    Posts:
    6
    Hi, just checking the UI window confirm you mentioned. On a side question, is there a way to set Paypal overlay window in-game? Instead of opening browser to paypal page. When i was checking paypal they have their own configuration to copy/paste but its not in C#, more for web pages i think.
     
  22. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,261
    I've answered that very recently, here is a similar question. In short, webview rendering would require mostly separate plugins for each mobile platform, so it is not something I would be able to integrate in this asset. There are some solutions on the Asset Store which specialize on that part.

    Just know that you would be exchanging security for convenience. Users are already familiar with payment workflows on their favorite mobile browser, while entering their payment credentials in an in-app webview could be suspicious.
     
    Maverickjw likes this.
  23. Neion85

    Neion85

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

    I have installed the latest version of the Simple IAP System and followed the install instructions. After checking Enable Integration and pressing apply, I get the following error:

    Assets\SimpleIAPSystem\Scripts\IAPManager.cs(291,48): error CS1503: Argument 2: cannot convert from 'ProductType' to 'UnityEngine.Purchasing.ProductType'

    How can I resolve this?
     
  24. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,261
    Hi @Neion85!

    Is this with the latest version of SIS and Unity IAP imported? Probably not related, but what Unity version are you using?

    Do you have any other script in your project that defines a ProductType class?
     
  25. Neion85

    Neion85

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

    I am using services core 1.4.3, In App Purchasing 4.4.1 and Unity version 2020.3.33f1. I do not have other scripts that define ProductType class. I removed the Xsolla package and the problem still persisted.
     
    Last edited: Oct 1, 2022
  26. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,261
    @Neion85 thank you for the additional details, unfortunately I was not able to reproduce this in a new project.

    There is a ProductType template class in SIS, which is not used when "Enable Integration" with Unity IAP is checked. It is defined in Enums.cs, starting at line 136. Since this is not compiled at all, it should not cause this issue - but to be 100% sure, you can also delete the code content between that #if !SIS_IAP ... #endif part.

    If this still does not work, could you please also verify in a new project? Thanks!
     
  27. sp1owlmightyg

    sp1owlmightyg

    Joined:
    Oct 2, 2022
    Posts:
    7
    Help! I've installed Simple IAP and Unity's IAP package and the 'enable integration' button doesn't work. I've managed to make it work once but I got all sorts of exceptions in the code. Unity version 2021.3.11, Unity IAP 4.4.1, Services Core 1.4.3. Prime31 solution is also in the project but I doubt it's the culprit. Also the project is configured in Unity Services.
     
  28. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,261
    Hi @sp1owlmightyg! Have you tried to do a reimport (right click menu) on the SimpleIAPSystem project folder? Also, maybe unchecking "Enable Integration" and pressing Apply, then checking it and pressing the button again?

    If you see error messages during the process, please post them here. Thanks!
     
  29. sp1owlmightyg

    sp1owlmightyg

    Joined:
    Oct 2, 2022
    Posts:
    7
    Hi @Baroni and thanks for the quick reply. I did try to re-import, it didn't work. Clicking on Enable Integration simply won't tick the box.
    If I click on apply I get:
    exception 34 times, with no way to know where they come from.
     
  30. sp1owlmightyg

    sp1owlmightyg

    Joined:
    Oct 2, 2022
    Posts:
    7
    Ok I downgraded Unity to 2020.3.40 and now it's clickable and integrated only that now I get these errors:
    Assets/SimpleIAPSystem/Scripts/IAPManager.cs(114,36): error CS0118: 'Product' is a namespace but is used like a type
    Assets/SimpleIAPSystem/Scripts/ReceiptValidator.cs(30,38): error CS0118: 'Product' is a namespace but is used like a type
    Assets/SimpleIAPSystem/Scripts/IAPManager.cs(649,38): error CS0118: 'Product' is a namespace but is used like a type
    Assets/SimpleIAPSystem/Scripts/IAPManager.cs(26,43): error CS0535: 'IAPManager' does not implement interface member 'IStoreListener.OnPurchaseFailed(Product, PurchaseFailureReason)'

    Now what?
     
  31. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,261
    I think I got that issue once in a different Unity version. If you click on the "Enable Integration" text (not the checkbox), it should be highlighted in blue. Then press Enter to toggle the checkbox. This is obviously a workaround but I have no clue why Unity just breaks the checkbox UI.

    Do you have any other script in your project that defines "Product" as a namespace, or a class "Product" that does not have its own namespace at all? Simple IAP System tries to use the template Product class in Enums.cs, or the one that comes with Unity IAP, but it seems like it does not get the correct one.
     
  32. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    I believe the new UGS Analytics namespace also has a Product object. I too received collisions in my existing IAP scripts when upgrading and got the same error regarding OnPurchasedFailed for this reason, and used the full name (UnityEngine.Purchasing.Product) on each occurrence. But now that I think about it, probably better addressed with a using statement.
     
    Baroni likes this.
  33. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,261
    Thanks for chiming in! But is it that random? I have tried reproducing the "Product" namespace clash an hour ago without success. Updated from Analytics (com.unity.services.analytics) version 4.0.1 to 4.2.0, Unity IAP 4.5.0. Checked source files in Analytics package but could not find a Product class. I'm still confused where this comes from - Simple IAP System classes are all in their own namespace :confused: Nevertheless, the using statement will come in handy though to be double safe!
     
  34. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    It's not random for me, see attached
     

    Attached Files:

  35. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,261
    Ah, that's why - I am using the Services.Core and Purchasing namespace in my IAPManager class, but not the Services.Analytics one (which the other Product class is part of). So in my OnPurchaseFailed method usually the correct class is chosen.

    upload_2022-10-3_19-0-5.png

    @sp1owlmightyg Could you please clarify about the duplicate Product class and where it comes from?
     
  36. netpost

    netpost

    Joined:
    May 6, 2018
    Posts:
    388
    Hi. I just bought your marvelous asset but I still have the error using Unity 2020.3.36f1 LTS:

    Assets\SimpleIAPSystem\Scripts\IAPManager.cs(7,13): error CS0234: The type or namespace name 'Services' does not exist in the namespace 'Unity' (are you missing an assembly reference?)
     
  37. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,261
    Hi @netpost, thanks for your purchase! The error is not related to your quote: Unity IAP makes use of Unity Gaming Services, namely com.unity.services.core since few versions ago. Please see the install instructions and check if you have imported this package as well.
     
  38. Neion85

    Neion85

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

    I just put a // in front of the error line and the payment still processes smoothly.
     
  39. GlennVerheij

    GlennVerheij

    Joined:
    Apr 21, 2018
    Posts:
    7
    Hello, I am using Simple IAP for my steam game.

    Am I correct that I have to use playfab which requires a login from the players side? Is there a way to avoid for players having to log in?
     
  40. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,261
    Ok - could you please let me know which line in what script you commented out, so I can investigate for others? I hope you don't mean line 291 in the IAPManager, since that would mean you are not adding any products to Unity IAP for initialization at all.

    Hi Glenn, Simple IAP System supports native Steam payments without PlayFab too. For that, you can still follow this guide but ignore all PlayFab related parts. In the video at the top, at minute 2:00, enable Steam Inventory Service.

    Regardless of whether you are using PlayFab or not, when running the game from within Steam, your players will authenticate directly with Steam and there is no need to enter any credentials.
     
    GlennVerheij likes this.
  41. GlennVerheij

    GlennVerheij

    Joined:
    Apr 21, 2018
    Posts:
    7
    Awesome, thanks for the quick answer :)
     
  42. netpost

    netpost

    Joined:
    May 6, 2018
    Posts:
    388
    Thank you so much for the quick reply and Info. It seems like I had Unity IAP purchasing version 4.1.5 installed when the latest was 4.5.
    Upgrading fixed it.
     
  43. sp1owlmightyg

    sp1owlmightyg

    Joined:
    Oct 2, 2022
    Posts:
    7
    Hi and sorry for the late response, you and @JeffDUnity3D are correct and there was an ambiguity even though the error was not phrased this way. I've changed all the places that threw errors to UnityEngine.Purchasing.Product and now it works.
    The namespace Product is coming from the project I'm working on but since I'm only a temp I'm not well-versed on all the parts of the codebase so on your side and Unity's side it seems OK to me.

    Thank you very much again.
     
    Baroni likes this.
  44. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,261
    @sp1owlmightyg Thank you for reporting back! All good - I would suggest recommending namespaces to the project owner then, it's really a best practice in the coding world :)
     
  45. sp1owlmightyg

    sp1owlmightyg

    Joined:
    Oct 2, 2022
    Posts:
    7
    And another question, is there a demo on how to use PayPal? Or I might have missed it somehow? I use this plugin just for that.
     
  46. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,261
    There is no separate demo for PayPal, since it can use the same example scenes as the other billing providers. You would just enable PayPal as the billing provider for a specific or all products. Please see the PayPal guide on how to proceed.
     
  47. sp1owlmightyg

    sp1owlmightyg

    Joined:
    Oct 2, 2022
    Posts:
    7
    Ahhh I think I understand now. Thank you.
     
  48. GlennVerheij

    GlennVerheij

    Joined:
    Apr 21, 2018
    Posts:
    7
    Hey, I have a followup question. I have all the Unity stuff implemented. But on Steam I get stuck with the "Item Definitions". Do I make this JSON myself? How do I tell Steam the prices of my In App Purchases? I only want to sell virtual currency through Steam.
     
  49. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,261
    Yes, you can find an example for the JSON file on the official Steam documentation. Also, this post answered a similar question in the past.
     
  50. michealcaj

    michealcaj

    Joined:
    Aug 18, 2017
    Posts:
    191
    Hello guys , I want to know if this can work for a Unity WebGl project....