To track in-app purchases made with our Windows Phone 8 applications, we would like to know in which currency the purchases are made from inside the application. Right now we know the price using the FormattedPrice property, like so:
public static async void LoadProductListing()
{
ListingInformation listings = await CurrentApp.LoadListingInformationAsync();
ProductListing product = listings.ProductListings["SomeProductID"];
String price = product.FormattedPrice;
}
This results in a price formatted with only a sign like €0,99
or $0.99
. For €
this is fine, for e.g. $
this is not enough information: we still don't know whether it's US dollar, Canadian dollar, Australian dollar, or Chilean Peso (which sign is also $). We would like to have this information with a proper ISO 4217 currency code (like EUR
, USD
, CAD
, AUD
, CLP
) or at least a symbol that explains the exact currency (like US$
, C$
, etc).
On Windows 8 it is possible to use the ListingInformation.CurrentMarket
property to get the locale of the current market (and thus the currency used), however there is a remark in the documentation:
Windows Phone 8
This API is not implemented and will throw an exception if called.
We recon using the system locale is not precise enough: it might not be the same as the locale used for the current market (but we could be wrong there!).
Is there any way to properly determine the in-app purchase currency from within a Windows Phone 8 application?
WP8 uses your Live ID payment profile region to select the market the phone uses and you cannot change this via a setting on the phone. I only happen to know this because my payment profile is set to Canada somehow (I'm from the US) and I am unable to change this via a setting on the phone.
However, back to the original question: your phone will always report the culture being used for in app purchases via System.Globalization.RegionInfo.CurrentRegion. Therefore, you can reliably get the correct currency code being used for in app purchases from:
var regionInfo = System.Globalization.RegionInfo.CurrentRegion;
var currencyCode = regionInfo.ISOCurrencySymbol;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With