Getting In App Purchase Prices. Incorrect Price?

I have a store in my game where users can buy things. Currently everything is hardcoded (ie. $1.99)

I’d like to switch it to use their localized currency and have the game display the price appropriate to where they live (ie. In Canada, the price might be $1.99 CAD, and in the US the price for the same item might be $1.49 US)

From what I have read, it looks like all this information can be pulled from the purchasing apis.

In one tutorial I was reading, it showed once the UnityPurchasing had been initialized, I can get the metadata for each shop item with the following code :

 public void OnInitialized(IStoreController controller, IExtensionProvider extensions) {
        foreach (var product in controller.products.all) {
            Debug.Log (product.metadata.localizedTitle);
            Debug.Log (product.metadata.localizedDescription);
            Debug.Log (product.metadata.localizedPriceString);
        }
    }

This appears to work… well, sort of. It does log out products and their prices… but does not appear to be loading the prices from what I set in the Google Play Console (where I defined the in app purchase items)… it appears to be grabbing whatever was set in a file I found in /resources/IAPProductCatalog.json (I think was auto generated at some point… not sure where it came from)

I assume it should be loading the pricing info from google and not this random config file? (not sure if I can delete it)

Any idea what I am missing?
Thanks!!

For fun, I just tried deleting that IAPProductCatalog.json file. After doing so it looks like it defaulted everything to some values (these values do not match what is in the google play console)

8408532--1110837--upload_2022-9-1_11-58-9.png

@Sparticus Unity IAP does not connect to a real store when running in the Editor. To see the real prices, you will need to deploy to an Android device. Your Debug.Log output will show in the adb logcat logs. The Sample IAP Project writes the debug output to the UI also, very handy for debugging issues like this. How To - Capturing Device Logs on Android

1 Like

Ok, makes sense, thanks :slight_smile:

Also, I’m moving this thread to the IAP forum, you’ll want to post there in the future. Thanks Unity Services - Unity Discussions