I am implementing in-app purchases for an app with support for several countries.
The In-App Billing Version 3 API claims that:
No currency co
You can't, this is currently not supported. There is a feature request for it, but it may or may not get implemented.
https://code.google.com/p/marketbilling/issues/detail?id=93
Here's a complete code:
ArrayList<String> skuList = new ArrayList<>();
skuList.add("foo");
skuList.add("bar");
final String[] prices = new String[skuList.size()];
Bundle querySkus = new Bundle();
querySkus.putStringArrayList("ITEM_ID_LIST", skuList);
Bundle skuDetails = _appActivity.mService.getSkuDetails(3, _appActivity.getPackageName(), "inapp", querySkus);
int response = skuDetails.getInt("RESPONSE_CODE");
if(response == 0) {
ArrayList<String> responseList = skuDetails.getStringArrayList("DETAILS_LIST");
int i = 0;
for (String thisResponse : responseList) {
JSONObject object = new JSONObject(thisResponse);
String sku = object.getString("productId");
final String priceCurrency = object.getString("price_currency_code");
String priceAmountMicros = object.getString("price_amount_micros");
float priceAmount = Float.parseFloat(priceAmountMicros) / 1000000.0f;
String price = priceAmount + " " + priceCurrency;
if(skuList.contains(sku)){
prices[i] = price;
i++;
}
}
}
From documentation:
price_currency_code ISO 4217 currency code for price. For example, if price is specified in British pounds sterling, price_currency_code is "GBP".
price_amount_micros Price in micro-units, where 1,000,000 micro-units equal one unit of the currency. For example, if price is "€7.99", price_amount_micros is "7990000". This value represents the localized, rounded price for a particular currency.
Now you just have to divide price_amount_micros by a 1000000 and concatenate it with currency.