Skip to content

[in_app_purchase] Add currencyCode and priceNumber (as double) to ProductDetails #65758

@erf

Description

@erf

Use case

Now ProductDetails.price is a string formatted in USD, which does not make much sense when you want to show the price formatted in local currency, as described by Apple:

To display the price of a product in the UI, use the locale and currency returned by the App Store. For instance, consider a user who is logged into the French App Store and their device uses the United States locale. When attempting to purchase a product, the App Store displays the product’s price in euros. Thus, converting and showing the product’s price in U.S. dollars to match the device’s locale in the UI would be incorrect.

Proposal

I would suggest to show both priceNumber (as double) and currencyCode (as String) in ProductDetails. You have both items in the wrappers skProduct for iOS and skuDetail for Android.

From skProduct you would need the price and priceLocale.currencyCode.

From SkuDetail you would need priceAmountMicros and priceCurrencyCode.

I think these are the most important and commonly used items from both. You would need to convert price and priceAmountMicros to a double value.

Metadata

Metadata

Assignees

No one assigned

    Labels

    c: proposalA detailed proposal for a change to Flutterp: in_app_purchasePlugin for in-app purchasepackageflutter/packages repository. See also p: labels.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions