[Closed] Storing Purchases offline

There is a closed thread that describes the problem I have run into here . The explanation does not explain where I would make this call:

ConfigurationBuilder config = ConfigurationBuilder.Instance(StandardPurchasingModule.Instance());
IAppleConfiguration appleStoreConfig = config.Configure<IAppleConfiguration>();
appleStoreConfig.appReceipt; // process

Like the author, I am basing my project on the IAPDemo.cs project. Where should I process the receipt?

My goal is to build the menu that is normally built online. My app works by having a list of non-consumable buttons in the UI at all times. Purchased buttons ‘work’, while the other buttons require an in-App purchase before they are converting to a ‘working’ button. So, a person should be able to see both, but when online be able to buy the buttons they don’t already own.

As you can see, that code is not functional and would not be expected to work. And can you elaborate, “Buttons require a purchase before they are converted to a working button.” Seems that the button would need to be working before you could make a purchase with it? This tutorial may help you. Unity IAP - Unity Learn

I have gone through the tutorial and I think my question is also about best practices for storing purchases for items. To elaborate, here is a screenshot of what my end goal is:

The user can buy 3-packs of content, and then use one sword at any given time. I want to combine the list of purchased swords with those available, to make it easy to expand their collection. All of the swords exist in the game but need to be activated by a flag that they have bought the pack.

Right now, this will work when the user is online by matching item ID’s in the IAP Catalog and what I have manually entered on the Apple App Store. The descriptions and titles come from the Apple store, regardless of what I’ve entered in the IAP Catalog. It’s quite inconvenient that the Apple Store does not allow importing the csv export from the Unity IAP Catalog and so I’m trying to figure out a reliable way to populate my scroll view of buttons, offline and online.

If the user is offline, I get no list at all, so I need to figure out how to populate the scroll view to look like this offline. I can add a note or warning that no purchase can be made until they are back online.

As far as I can tell both IAP demos assume the user will be online and builds out the lists. So, my questions are about implementing this in the most efficient and secure way possible. I see two options to pursue, which one is better?

  • Create a local json file of purchased items, secured with a hash entry as described in this 2016 Best Practices talk
    -Disadvantage is I need to also store all the descriptions and titles from the App store or IAP Catalog (which may not match)
  • Parse the appReceipt as described above
    -will the receipt include descriptions
    -can I get a list of all products from the appReceipt?
    -is there any encryption advantage using the appReceipt for tracking purchases?

We are looking to add inventory management in a future release. In the meantime, you could consider storing in PlayerPrefs, but you would want to also test the uninstall/reinstall flow. There is also this post Simple Local Data Storage