Using Fetch for Virtual Items



  • I’m currently working on localizing my app and love the fetch feature to grab localized descriptions and currencies.

    Is there a reason to not do this with non-consumable virtual items as well? I’ve started playing around with the shop manager code a bit and was able to fetch the localized description on apple’s backend by creating free IAP products in AppStore connect. However, it’s currently fetching the cost as well despite it being free and populating the buy field with real currency instead of in game currency. I’m planning to figure out a workaround for this, but wanted to check here first. Is there anything I should be aware of? I plan on launching to google play and iOS.

    Thanks!



  • Hey, glad to hear that the fetch feature is being used :)

    I think you are running into a misconfiguration with your products in SIS and the App Store. For a bit of a background:

    Products bought with real money ("Default" products in SIS) have to be created on the App Stores, which allow for localization on the store backend itself. With "Fetch" enabled in SIS, it retrieves that localized data and overwrites any local data. If you would like to localize one Text component, but not another, you could unassign that Text component in the IAPItem component on the item prefab. Since this means the local data (from our IAP Settings editor) can't be set anymore either, e.g. for the buy button you could just write "BUY" in its Text component on the prefab. This would then localize e.g. the Title but always keep "BUY" on the buy button.

    Products bought with currency, i.e. virtual products, do not exist on the App Stores - and should not be created there. It does not matter whether they are non-consumable or consumable products, as the App Store could not restore any of them. As such, they only exist within your game, therefore cannot access any localization data from App Stores. You can still fetch realtime data (e.g. pricing for sales) for these - via PlayFab integration. However, there is no localization feature built in.

    So to come back to your question: I guess you created the virtual product on the App Store?



  • I suppose I should explain a bit more about my game's store. I have in-game coins available to purchase for real money, which I want fetch to get both the description and price from the App Store backend. The SIS IAP manual was very clear and this configured without a problem. My store also has non-consummables that can be purchased with the in-game coins. From reading the documentation, I understood that fetch was not intended to work on these items whatsoever. I also would prefer to not sacrifice the fetched local price for the benefit of having the items purchased with coins list their price properly.

    So, to your question, yes, I created the virtual product on the App Store. In SIS IAP I did the following:

    • Removed the if statement at the bottom of InitIds in IAP manager so that virtual IAP items are added to the list

    • Created an additional Init method in IAPItem that is identical to the other method except I removed the last if statement regarding price

    • Last, I modified OverwriteWithFetch so that virtual items are not skipped over, then called my newly created Init statement on virtual products, while still calling the original init on non-virtual products.

    This morning I was able to test fetch with a German localization and everything is working as intended, prices show in euro for real currency items and their localized descriptions appear. Then for my non-consummable items purchased with in-game currency, their prices are shown in coins, while their descriptions are localized from the App Store virtual product I made.

    A followup question - why should virtual products not be created on the App Stores? If the product data for virtual items is not able to be restored, that's fine. I'm really only concerned with the localization at this point.



  • Welp, nevermind. Looks like things broke down when I tried using fetch in conjunction with virtual locked items... Oh well.



  • Thanks for the detailed explanation. For the iOS App Store, Apple reviews all products to find out whether they can be purchased in your store - for real money. We already had an app decline where a product was defined in the App Store, but not in-game, or with a difference in pricing (currency or money).

    Several years ago we had support for Smart Localization, an asset for localizing Text components and images. Everything offline, also allowing import of multiple languages via Excel or CSV. However we removed that at the time its developers stopped supporting it. I would recommend building your own localization integration if you don't want to have more issues when it comes to releasing your app to the stores.

    As you've found out by coding so far, we've programmed several hurdles for preventing virtual items to be fetched from the App Stores :)


Log in to reply