Search Unity

  1. Unity support for visionOS is now available. Learn more in our 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

    163 vote(s)
    85.8%
  2. Voxel Busters

    10 vote(s)
    5.3%
  3. Stans Assets

    13 vote(s)
    6.8%
  4. Prime31

    4 vote(s)
    2.1%
  1. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,242
    @ishangill I have not used Google Firebase / Google Play Games Services myself, so unfortunately I am unable to give you any specific advice on how to use that.

    If your question is how to add product IDs dynamically at runtime, then you would want to disable the "Auto Initialize" checkbox on the IAPManager in the inspector. After loading your product IDs, add them to IAPManager.GetInstance().asset.productList. When you're done, call IAPManager.GetInstance().Initialize().

    If you want to persist user in-app data to the cloud (local purchases, virtual currency) then the DBManager provides two methods for this: Read() and Overwrite(string otherData). Read returns the local data for you to upload, while Overwrite takes the string you pass in (e.g. from Google Play Games Services) and overwrites the local data. If your game is fully online and you do not want to write any data to local storage, you can also set the StorageTarget on the DBManager inspector to "Memory".
     
  2. mark3306

    mark3306

    Joined:
    Dec 8, 2017
    Posts:
    3
    Hello, I'm integrating this asset and I must say that I'm very impressed with how well it simplifies what can be an extremely complex integration when dealing with multiple application distributors.

    Quick question - I'm implementing a "payment processing" pop-up in my game and in order to know when it is safe to hide the popup, I've subscribed to the IAPManager.purchaseFailedEvent and IAPManager.purchaseSucceededEvent actions. My question is - is it safe to assume that one of these two actions are guaranteed to be invoked even in the case of a communication timeout or should I be implementing my own timeout monitoring logic?
     
  3. ruiswang

    ruiswang

    Joined:
    Feb 22, 2023
    Posts:
    6
    Hi Baroni, thank you for your assets and documentation!

    I followed your instructions on iOS App Store and could not get it work for subscription products. (For consumable and non-consumable it works perfectly.)

    I guess maybe there's something to do with the new subscription system in App Store? (Before, as in your documentation screenshots, subscriptions were in the same panel together with consumable and non-consumables, but now it is under a separate panel)
     

    Attached Files:

  4. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,242
    Hi @mark3306, thanks for using SIS! Yes, one of these callbacks is guaranteed to be invoked. There is just one exception to this, and that's when using PayPal payments which comes with a "confirmation" window. The succeeded or failed event is invoked after that window has been confirmed and until then, other input is blocked. If you do not implement PayPal, you can ignore this.

    Hi @ruiswang, thanks for sending a screenshot of Apple's new subscription section. I cannot imagine it would break any existing implementations, but I will do another test in the coming days (probably Thursday) and report back.
     
  5. mark3306

    mark3306

    Joined:
    Dec 8, 2017
    Posts:
    3
    Thanks for the quick reply, @Baroni ! That is comforting to know that I don't need to manage my own timeout logic. I did notice a potential issue while testing with Steam today though. If I hit cancel at the bottom of the payment dialog (screenshot attached), it seems none of the callbacks are invoked. The succeeded callback works fine if I instead complete the purchase. Is this a known issue in the sandbox environment or should I expect this behaviour in a production build as well?

    upload_2023-10-17_20-33-55.png
     
  6. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,242
    Following up on the subscriptions @ruiswang, I have re-tested on a new iOS build and they still work fine as expected. In my dev account I have one subscription group with 2 subscription products. Could you explain what exactly you "could not get it work"? For example if you do not even receive the product details like localized prices, your product could be in the wrong status and you need to partly submit it.

    Thanks for your message @mark3306. I was mainly referring to iOS and Android (besides PayPal) and totally forgot about Steam, sorry for that. I tested locally and tried to get a cancelled response for the purchase popup, but none of the callbacks sent any response back to the app. It's basically like when the Steam purchase popup (shopping cart) is initialized but declined, it simply vanishes in the background. Unfortunately without callback API for this, I am not able to hook up the failed purchase action. Meaning as per your requirement, you would still need to add a timeout logic - sorry again.
     
  7. ruiswang

    ruiswang

    Joined:
    Feb 22, 2023
    Posts:
    6
    Hi Baroni, thank you for your reply!
    Glad to know your side works! So now I know the mistake must be from my part. I have attached some logs in xcode and my subscription status screenshots. (As you can see from the log in xcode the only received product is the one from non_consumable) Do you think the reason is that those two subscriptions have not been submited? Must it be submited before I can load from the store? Thank you for your time and looking forward to your reply :)
     

    Attached Files:

  8. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,242
    Thanks for the screenshots! The products do not need to be submitted for testing. As far as I can see, you have an additional space character in your subscription product IDs, right at the beginning. Remove that and they should be fetched correctly.

    If you are otherwise happy with the asset, please do not forget to leave a review at some point :) Thanks!
     
  9. ruiswang

    ruiswang

    Joined:
    Feb 22, 2023
    Posts:
    6
    Hi Baroni, after I removed the space now it works!!! Thank you so much! I have left a review and wish more people will support you in the near future.
     
    Baroni likes this.
  10. ishangill

    ishangill

    Joined:
    Nov 28, 2017
    Posts:
    36
    Hello Baroni.
    I need some help from you .
    I want to enable ( Anti Cheat Toolkit) From IAP manager. But when i Swiched Internal to Anti cheat Tool Kit then warning message shows in console. I have seen in projects settings but no any option is found in the settings.
    I have attached the warning screenshot image here.

    And if i use Encrypt with Playerprefs or Presistent Datapath then error shows in console. I attached the image here.

    And how can i set one time default coins value. Means when player install the app then total coins 10,000 for players .
     

    Attached Files:

  11. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,242
    Hi @ishangill, please see the documentation for a ACTK setup guide.

    The reason for this error is explained on this page, see the yellow box. Each time you change the storage method you have to delete the local storage since the old data cannot be read anymore.

    You can set a default currency amount in Project Settings > Simple IAP System > Currencies > Your Currency.
     
  12. Gushmeister

    Gushmeister

    Joined:
    Apr 30, 2018
    Posts:
    50
    Hey @Baroni ,

    after updating from inapp purchasing 4.5 to the newest, I‘m getting this error:

    Assets/SimpleIAPSystem/Extensions/PlayFab/Scripts/PlayFabStore.cs(25,18): error CS0101: The namespace 'SIS' already contains a definition for 'PlayFabStore'

    What am I doing wrong? I also updated the simple iap asset, but it didn‘t help.

    Best regards
     
  13. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,242
    Hi @Gushmeister,

    well, the error makes clear that there is already a PlayFabStore class within your project. Maybe you have moved the old one and imported the new, so now you have two of them? Did you do a search for that file?
     
  14. Gushmeister

    Gushmeister

    Joined:
    Apr 30, 2018
    Posts:
    50
    Hey @Baroni I searched for it and there is only one. But I can double check again, when I come home.

    Best regards
     
  15. SuperMiro

    SuperMiro

    Joined:
    Nov 23, 2018
    Posts:
    50
    Hi. Let's say I use DBManager to store lives but I want to check how much lives the player has so I can update it value and also do things in the back end.

    I noticed for coins it is get currency. but how about other non currency products that are consumable too. How do i check the value of the store items.
     
  16. SuperMiro

    SuperMiro

    Joined:
    Nov 23, 2018
    Posts:
    50
    Also how to trigger a discount for certain product internally? (Via in game code not via PlayFab)
     
  17. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,242
    Hi, you can find an overview of all available DBManager methods on the Scripting Reference. You are probably looking for DBManager.GetPlayerData(id).

    You can get the IAPObject via IAPManager.GetIAPObject(id) at any time, optionally set its "discount" bool to true (for showing a SALE game object) and modify its "priceList" entries.
     
    SuperMiro likes this.
  18. danialaddin66

    danialaddin66

    Joined:
    Aug 26, 2019
    Posts:
    7
    Hello again!
    I have been facing and issue with my PayPal payments, a user I have was purchasing a subscription via PayPal but they immediately pressed the cancel button on the popup before the PayPal showed up, but somehow the payment was still consedered successful and gave back a transaction ID and got saved on my database, how do I catch such a behavior? Or wasn't it supposed to get handled anyway through the API?
     
  19. Gushmeister

    Gushmeister

    Joined:
    Apr 30, 2018
    Posts:
    50
    Hey @Baroni I'm not getting the update to work. There is no PlayfabManager Prefab in 5.2.7 ?

    Therefore it says there is no "OnLoggedIn()"-Function in the PlayfabManager, since the script is completely different then in the previous version?

    Did I miss something?
     
  20. Gushmeister

    Gushmeister

    Joined:
    Apr 30, 2018
    Posts:
    50
    Hey @Baroni I found out what the problem was. It's as simple as you could imagine it in the "How to Update"-Guide :). I should just had to re-click in the SIS Settings on the "Custom Extensions" area on the "Playfab (External SDK)" button again. If there were custom-changes made in the code, those should be re-saved somewhere else. It then creates the Prefab again and everything works as before. I just love your asset.
     
  21. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,242
    Hi @danialaddin66, PayPal creates a transaction ID the moment a user presses a buy button. This transaction ID is then either completed by entering PayPal credentials and refreshing it in the frontend, or declined by cancelling or doing nothing for several days (at which point is expires). Do you check the payment state for the transaction on your server before saving it? You should definitely do that.

    @Gushmeister Hey again! I would have told you that today :) It is correct that custom changes should be saved somewhere else - but even better, not done to the asset's code at all, since the foundation should be open enough to hook everything up from your own scripts. Or, with an optional GitHub access purchased on my website and then merged into the project ;) Glad you are up and running again!
     
  22. ishangill

    ishangill

    Joined:
    Nov 28, 2017
    Posts:
    36
    Hello Baroni.

    Again i need some help from you related encrypt . I tried too much time . i also follow steps from online documentation
    But when i tried enable encryption then every time error shows.
    My game is for android platform. And tommorow i will release my game in closed testing only encryption set is left in my project.
    Please help me.
     

    Attached Files:

  23. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,242
    Hi @ishangill, sorry for the delay. Weekend responses are not part of free support, that is only included via private support on my website.

    To repeat as I mentioned previously, every time you enable or disable the "Encrypt" checkbox, or change the encryption key, you have to clear your local device storage. If you are testing on a mobile device, this can be done by uninstalling and reinstalling the app. If you are testing in the Unity Editor, this can be done by pressing the Project Settings > Simple IAP System > Tools > Local Storage > Clear button (at runtime).
    Alternatively, by running example scene 11 as in your screenshot and pressing the "Clear Local Data" button at runtime on both Unity Editor or mobile device.

    To make this absolutely clear: if you change something with the encryption settings and run a scene, you will see that error. You then have to clear device storage as written above. After that, if you run the scene again, you will not get that error anymore. In a production app you should not change encryption settings since that would corrupt local storage for all users.
     
  24. ishangill

    ishangill

    Joined:
    Nov 28, 2017
    Posts:
    36
    Thanks for your message.
    I was waiting for your reply.
    I am doing these steps for enable encrypt :
    1 Encryption type None in DB Manager .
    2 In run time i opened the projects window and clear all playerprefs
    3 Then after i off the runtime and change the settings in IAP manager and set Encryption type Internal, encrypt cheked and storage is Playerprefs and i set the temporary password is cvcv5566.
    4 Then again in playmode Error shows :
    CryptographicException: Bad PKCS7 padding. Invalid length 0.
     
  25. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,242
    @ishangill That's what I wrote. Every time you change the encryption settings you have to clear local storage. So after step 3, you have missed doing that again.

    After that encryption is enabled and no error will be thrown anymore.
     
  26. ishangill

    ishangill

    Joined:
    Nov 28, 2017
    Posts:
    36
    hello Baroni thanks for reply above messages .
    .Now recently i has purchased third party asset Anti cheat tool kit. And according to your documentaion i checked ACTK is here in settings and enable Anti cheat tool kit in IAP Manager.
    So i want to know these settings is ok .
     
  27. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,242
    If you set "Encryption Type" = "Internal" (using an encryption key), you are not making use of ACTK. Please revisit the ACTK guide again. If you set "Encryption Type" = "Anti Cheat Toolkit" on the DBManager inspector you are good to go.
     
  28. 3dmars

    3dmars

    Joined:
    Jan 3, 2016
    Posts:
    52
    Hi @Baroni , are there any news concerning the support of Economy v2? Do you plan providing the support for it soon? v1 is considered to be legacy now and PlayFab UI has slightly changed, which, for example, doesn't allow uploading a json file for currency (I needed to add it manually), so the documentation is not up-to-date. Because Simple IAP System currently doesn't support Economy v2, I am wondering if it makes sense to use your asset. Definitely I would like to use Economy v2, not the legacy v1.
     
  29. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,242
    Hi @3dmars, thank you for your request. Reading that you would use SIS, but only with Economy v2, is much appreciated since I did not receive any feedback from PlayFab users in the past months.

    Development on SIS happens mostly based on feedback and requests, so I have not started working on this actively yet. Unfortunately I have some private circumstances at the moment that do not allow this right now, but I could start in mid-December, with a release and updated documentation early January.

    I hope that this would fit to your development timeline, however I also understand if it does not. Thanks again.
     
    3dmars likes this.
  30. zedoppa

    zedoppa

    Joined:
    Feb 26, 2020
    Posts:
    12
    Hello, I'm trying to integrate PayPal in my standalone games for Android platform but when I tested it in Editor using your example scene, it gives me this error.
    • I already setup the Return URL to https://www.google.com (for temporary)
    • Already assigned the sandbox client ID and sandbox secret (double checked the data as well in case I made a mistake for adding some space at the end of it)
    • Changed the currency code from USD to MYR because that's what I'm trying to test with first
    I pretty much follow all the steps in the docs for PayPal integration without PlayFab but yeah I still can't find what is it that I'm missing.
     
  31. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,242
    Hi @zedoppa, thanks for the details. From the URL in your screenshot I can see that you are trying to purchase a subscription product. Did you create the subscription in the PayPal backend and copy-pasted its ID in the product's override section for PayPal? This can be seen in the PayPal guide as well, and would be the last thing you did not mention in your post.
     
  32. zedoppa

    zedoppa

    Joined:
    Feb 26, 2020
    Posts:
    12
    Yeah forgot to mention that sorry.

    I did the PayPal ID as well. Like I said I pretty much follow all the steps in the PayPal guide from start to finish and tested it out with your example scene.

    EDIT:
    I want to test for subscription with PayPal, but it seems like it doesn't work. Is it not gonna work because of sandbox and must go live?
     
    Last edited: Nov 22, 2023
  33. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,242
    @zedoppa No, testing subscriptions can be done with the PayPal sandbox as well. To further elaborate two additional things that might not be that clear from reading the guide:

    • if you want to test sandbox subscriptions, you have to create the subscription ID in the sandbox environment. I just saw that this is not explicitly mentioned in the guide. So, you have to log in using your @business.example.com PayPal account (that you've created on developer.paypal.com > Sandbox accounts) on https://www.sandbox.paypal.com/billing/plans. To repeat, this has to be a sandbox business account, not your company account. You will then see an identical page to create subscriptions, but for the sandbox.
    • in Unity, make sure that "Development Build" is enabled, as mentioned in the guide at the end. Otherwise your build might try to reach the PayPal production environment.

    Hope this helps!
     
    zedoppa likes this.
  34. zedoppa

    zedoppa

    Joined:
    Feb 26, 2020
    Posts:
    12
    Thank you, it works now! :D

    Now I know that you need to use sandbox account to create the subscription plan for sandbox client instead of using live account. And yeah it is not explicitly mentioned in the guide so I was confused why it doesn't work.
     
    Baroni likes this.
  35. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,242
    Great! If you have more questions, do not hesitate to ask here. Otherwise, a review on the Asset Store would be much appreciated at some point in the future, when you have the time :)
     
    zedoppa likes this.
  36. ishangill

    ishangill

    Joined:
    Nov 28, 2017
    Posts:
    36
    Hello Baroni.
    I need some help from you . When i purchased any item from ( in game currency) or (Real money). Then message window shows (product ID) With bought. I want message window show Name of item Not ID how can i do this.
    I attached 2 images here. In Images Car carrier is truck , when i purchase the truck then messsage window shows
    product (ID) bought. But I want message window shows the Name of product.
     

    Attached Files:

  37. zedoppa

    zedoppa

    Joined:
    Feb 26, 2020
    Posts:
    12
    I have another question, can I get PayPal subscription duration once user has purchased it?

    I can get PayPal orderID from return URL but can't get access to PayPal duration left or date purchased.

    I tried to get current date and save it to if the purchase succeed. But I just noticed I can't get new date if user continue paying the subscription for the next cycle.
     
  38. zedoppa

    zedoppa

    Joined:
    Feb 26, 2020
    Posts:
    12
    Go to IAPListener.cs and go to HandleSuccessfulPurchase method.

    Add this line at the top of switch statement there,
    Code (CSharp):
    1. IAPProduct product = IAPManager.GetIAPProduct(productID);
    Then, scroll down to the bottom of the switch statement until you found default case, then change the productID to product.title.

    Below shows how I made it work:
    Code (CSharp):
    1. public void HandleSuccessfulPurchase(string productID)
    2. {
    3.     if (IAPManager.isDebug) Debug.Log("IAPListener reports: HandleSuccessfulPurchase: " + productID);
    4.  
    5.     // Add this line at the top of switch statement
    6.     IAPProduct product = IAPManager.GetIAPProduct(productID);
    7.  
    8.     //differ between ids set in the IAP Settings editor
    9.     switch (productID)
    10.     {
    11.         // ....
    12.         // A LOT OF OTHER CASE HERE IF U HAVEN'T CHANGED ANYTHING HERE
    13.  
    14.         default:
    15.             ShowMessage("Product (" + product.title + ") bought!");
    16.             break;
    17.     }
    18. }
     
    Last edited: Nov 28, 2023
    ishangill and Baroni like this.
  39. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,242
    Hi @ishangill, please see the post from zedoppa below yours, which explains this very well. Please also refer to the programming guide.

    Hi again, as written in the Prerequisites section as a "warning", the native PayPal implementation basically requires you to manage player inventory and purchase states on a server. The way this works, is that a successful subscription sends its data to the returnURL you defined in the IAP Settings. From there, you can get its ID (see the response sample). Then, you can use this ID to get more subscription data, such as its creation time, active state, renewal cycles, last payment and so on and manage the player's inventory with this information.

    You could avoid a server and get the ID on the client side too using a show order details call, passing in the order ID, however that requires an access token and so the client has to authenticate first using your CLIENT_ID and CLIENT_SECRET values. That would not be that secure and more prone to errors, since everything is in the clients hands.
     
  40. zedoppa

    zedoppa

    Joined:
    Feb 26, 2020
    Posts:
    12
    So, basically I need to code myself on getting those extra details on the subscription they purchased based on the references you just gave? It wasn't included in the Simple IAP System?
     
  41. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,242
    Yes and no, as written on the native PayPal guide I linked above. Simple IAP System does not send client requests using your server credentials because that is insecure. It is recommended to either use your own server for this, or use the PlayFab PayPal implementation which handles the server part, as written in the guide as well.
     
  42. zedoppa

    zedoppa

    Joined:
    Feb 26, 2020
    Posts:
    12
    I see.. Currently I'm using Firebase and not PlayFab. Is it compatible?
     
  43. ishangill

    ishangill

    Joined:
    Nov 28, 2017
    Posts:
    36
    Thanks a lot . Zedoppa and Baroni.
     
    zedoppa likes this.
  44. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,242
    That's a broad question! Both are services that provide separate features for the same or different things. PlayFab requires a user to authenticate before being able to send requests. I assume this is the case with Firebase too. According to this (old) thread, there could be a way to use the same login token for authenticating with Firebase and PlayFab. If you are going to use PayPal with PlayFab, it will manage your players inventory automatically, since that is the main feature of it. Therefore, it will not make much sense to save player inventory both on Firebase and PlayFab, for example.

    Also, the PlayFab guide will explain additional restrictions (depending on whether your game is an online game or not) and provide an insight into what PlayFab would do. The screenshots could be outdated with their Economy V2 update, but the functionality should be the same. An update to the guide is planned for January.

    To make this clear, if you are not expecting hundreds of cheaters or fake receipts sent to your app, implementing client side order validation with PayPal could be a way. Definitely not the best, but it would avoid having to implement the whole PlayFab SDK (and all workflows and limitations that come with it) just for one purpose - checking the current subscription status. If Firebase allows for server side code, you could also let the clients send their order ID to Firebase, and have it check for the current status periodically.
     
    Last edited: Nov 27, 2023
    zedoppa likes this.
  45. zedoppa

    zedoppa

    Joined:
    Feb 26, 2020
    Posts:
    12
    Okay thanks for the explaination. I think I'm gonna go for checking the subscription status through PayPal by client validation then since it is much easier to integrate although it's not the best.

    Thanks for the tips @Baroni , appreciate it!
     
  46. Rachan

    Rachan

    Joined:
    Dec 3, 2012
    Posts:
    746
    there possible to validation a receipt of Consumable item in Unity IAP that has been purchased long time ago?
     
  47. Rachan

    Rachan

    Joined:
    Dec 3, 2012
    Posts:
    746
    and what is AppleTangle ? it still missing!
     
  48. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,242
    Consumable receipts do not exist throughout app restarts. If a consumable receipt has been acknowledged by the App Store, it is treated as consumed and gone. Therefore, no, consumable receipts are usually only validated at the time the product is purchased.

    It is generated by Unity IAP when you use their editor script located at Services > In-App Purchasing > Receipt Validation Obfuscator. AppleTangle will then be generated in your project at Scripts > UnityPurchasing > generated. This should have happened automatically if you have followed the Client Side Receipt Validation guide.
     
  49. makaka-org

    makaka-org

    Joined:
    Dec 1, 2013
    Posts:
    975
    Hi, @Baroni. Please tell me, what could be the problem?
    I updated SIS to 5.2.7. I test on iOS with Encryption enabled: Player Prefs, Internal.

    The key was not changed since 2019 year. The App is deleted from the phone before build.

    iOS 17.1.2, XS Max
    Unity 2021.3.33

    I get such error:
    Code (CSharp):
    1. CryptographicException: Bad PKCS7 padding. Invalid length 0.
    2.   at Mono.Security.Cryptography.SymmetricTransform.ThrowBadPaddingException (System.Security.Cryptography.PaddingMode padding, System.Int32 length, System.Int32 position) [0x00000] in <00000000000000000000000000000000>:0
    3.   at Mono.Security.Cryptography.SymmetricTransform.FinalDecrypt (System.Byte[] inputBuffer, System.Int32 inputOffset, System.Int32 inputCount) [0x00000] in <00000000000000000000000000000000>:0
    4.   at SIS.DBManager.Decrypt (System.String toDecrypt) [0x00000] in <00000000000000000000000000000000>:0
    5.   at SIS.DBManager.InitDB () [0x00000] in <00000000000000000000000000000000>:0
    6.   at SIS.IAPManager.Awake () [0x00000] in <00000000000000000000000000000000>:0
    -----
    I also noticed, that after I made a Clearing Local storage on "Tools" tab in settings, I started getting this error all the time in Editor:
    Code (CSharp):
    1. CryptographicException: Bad PKCS7 padding. Invalid length 0.
    2. Mono.Security.Cryptography.SymmetricTransform.ThrowBadPaddingException (System.Security.Cryptography.PaddingMode padding, System.Int32 length, System.Int32 position) (at :0)
    3. Mono.Security.Cryptography.SymmetricTransform.FinalDecrypt (System.Byte[] inputBuffer, System.Int32 inputOffset, System.Int32 inputCount) (at <:0)
    4. Mono.Security.Cryptography.SymmetricTransform.TransformFinalBlock (System.Byte[] inputBuffer, System.Int32 inputOffset, System.Int32 inputCount) (at <>:0)
    5. SIS.DBManager.Decrypt (System.String toDecrypt) (at Assets/SimpleIAPSystem/Scripts/DBManager.cs:942)
    6. SIS.DBManager.Read () (at Assets/SimpleIAPSystem/Scripts/DBManager.cs:720)
    7. SIS.DBManager.InitDB () (at Assets/SimpleIAPSystem/Scripts/DBManager.cs:128)
    8. SIS.DBManager.Init () (at Assets/SimpleIAPSystem/Scripts/DBManager.cs:114)
    9. SIS.IAPManager.Awake () (at Assets/SimpleIAPSystem/Scripts/IAPManager.cs:165)
    10.  
     
    Last edited: Dec 10, 2023
  50. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,242
    Hi @makaka-org, that error message has been covered in a different context above, in this post. It is always shown when the decryption tries to decrypt something that is either not encrypted to begin with, or with a different encryption key.

    If you press the "Local Storage > Clear" button in the editor, you should only see this error once. After re-entering runtime, it should not occur again. Also, if you haven't changed anything, obviously it should not be thrown.

    From what version did you update? Could you try adding PlayerPrefs.GetString("SIS_data") before the IAPManager initializes, to see what is stored on the device? Alternatively, is any data displayed in SIS Tools > Local Storage?