Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get separate price and currency information for an in-app purchase?

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 conversion or formatting is necessary: prices are reported in the user's currency and formatted according to their locale.

This is actually true, since skuGetDetails() takes care of all necessary formatting. The response includes a field called price, which contains the

Formatted price of the item, including its currency sign. The price does not include tax.

However, I need the ISO 4217 currency code (retrievable if I know the store locale) and the actual non-formatted price (optimally in a float or decimal variable) so I can do further processing and analysis myself.

Parsing the return of skuGetDetails() is not a reliable idea, because many countries share the same currency symbols.

Currencies

How can I get the ISO 4217 currency code and non-formatted price of an in-app purchase with the In-App Billing Version 3 API?

like image 393
Panda Pajama Avatar asked Jun 11 '13 07:06

Panda Pajama


People also ask

How can I set country specific pricing for in-app purchase products?

Open Play Console and go to the App pricing page (Products > App pricing). Click Set price. Review the table in the "Local prices" section. In the "Price" column, review the local prices for each country.

How do you find out the cost of in-app purchases?

Locate “In-App Purchases” heading and tap it. (If In-App Purchases are available, it will say “Yes” and have a downward-pointing carat beside it.) After tapping the entry, a list will be revealed showing all of the app's In-App Purchases and the price of each one.


2 Answers

Full information can be found here, but essentially in August 2014 this was resolved with:

The getSkuDetails() method

This method returns product details for a list of product IDs. In the response Bundle sent by Google Play, the query results are stored in a String ArrayList mapped to the DETAILS_LIST key. Each String in the details list contains product details for a single product in JSON format. The fields in the JSON string with the product details are summarized below

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".

like image 198
Steven Craft Avatar answered Sep 22 '22 06:09

Steven Craft


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

like image 32
Nikolay Elenkov Avatar answered Sep 21 '22 06:09

Nikolay Elenkov