"use the Product's cross-platform identifier when making API calls" meaning?

I’m working on implementing IAP using script. I’m publishing my app on Google Play and Apple Appstore.

To initialize the product, I use code like this.

public class MyIAPManager {
    public MyIAPManager () {
        var builder = ConfigurationBuilder.Instance(StandardPurchasingModule.Instance());
        builder.AddProduct("100_gold_coins", ProductType.Consumable, new IDs
        {
            {"100_gold_coins_google", GooglePlay.Name},
            {"100_gold_coins_ios", AppleAppStore.Name}
        });
        // Initialize Unity IAP...
    }
}

In the doc, I see “use the Product’s cross-platform identifier when making API calls”. What does this mean?

public void OnPurchaseClicked(string productId) {
    controller.InitiatePurchase(productId);
}

Do I pass “100_gold_coins”, or “100_gold_coins_mac” (on Appstore) and “100_gold_coins_google” (on Play Store) as parameter for productId?

Just use the same productID on all platforms. There is no need to have platform specific names at all. But you would pass 100_gold_coins in your example.

1 Like