Currency of in-app billing transaction - in-app-purchase

I see that the response I get from Google Play after the user had purchased one of my in-app products contains the following information:
Description, ItemType, Json, Price, Sku, Title and Type
Price is a string that contains the currency and price. eg: "€1.17".
I would like to get the same price information in a more structured way and separately. Something like a three digit ISO code of the currency and the price in numeric format, without having to parse the string, which would have been ugly and unsafe.
Do you think that there is a way to do this?

Check price_amount_micros field.
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".
More here: In-app Billing Reference

Related

What type should I use to store the ISBN number in C?

I'm creating a code which storing the book data into a struct. So, the data including the book's title, author's name, price and ISBN number (which including the dashes to group the 13-digit code). So for title and name, for sure using string and also float for price. But I'm stuck in ISBN number because it containing dashes. So, what type should I use to store the numbers and dashes?
I'm still a beginner in coding program. :(

Where can I find the names of currency sub-divisions such as cents, centimes,

This should be useful for anyone who needs to write out amounts in words in SAP.
I need to convert an amount, e.g. $100.15, into words ("One hundred dollars and fifteen cents"). For the amount, I use function module spell_amount, which gives me "one hundred" and "fifteen". The name of the currency is easily found in table TCURT. Where can I find the name of the currency subdivision?
I think there is no such table. There are already some discussions about it (e.g at SCN: Table for currency) and the conclusion is: Make your own table.
If you want to create the table, you may get the name of sub-divisions in the German Wikipedia-article for ISO 4217 (Untereinheit means sub-division) or List of circulating currencies

How to sum up different currencies in Rails app?

I am currently building a Ruby on Rails invoicing application that is multilingual and supports a range of currencies. In the dashboard view all invoices a user has produced are totalled.
Now it would be nice if a user could choose the currency for each invoice.
But how can those invoices be totalled if different currencies are used?
E.g. if these three invoices were created today:
Invoice No. 1: $1000.00
Invoice No. 2: $2000.00
Invoice No. 3: €1000.00
Total: $4333.60
----------------------
The dollar-euro exchange rate would have to be based on each invoice's date of course.
How can this be achieved in Rails and does it even make sense?
Thanks for any pointers.
The sum of of multiple invoices using different currencies is not a single number, it's a collection of numbers. If you have a 20 USD invoice, a 15 EUR invoice, and a 20 EUR invoice, the sum is "20 USD + 35 EUR".
At the time when a payment is made from a single account using a single base currency, then a conversion will be performed to determine how much will have to be paid in that currency to cover the total converted costs. Presumably, there will also be currency conversion fees added at that time.
It would be convenient if you change the currency to a single one, either euro or dollar right when the user makes an invoice. That is, you save the 'converted' value in your database. In this way you won't have to lookup for past day rates.
Eu_central_bank provides exchange rates.

ios Load a tab separated text to Dictionary and UIPickerView

I am trying to implement a UiPickerView which will show the currency name and its symbol.
For example: United Stated of America, Dollars $
I have an entire list of 406 currency names containing the currency identifier, currency name and symbol which is tab seperated:
USD United Stated of America, Dollars $
VND Vietnam, Dong ₫
I don't want to show the identifier to the user, just the name and symbol. I plan to use the identifier for use in the code.
My questions are
What is the best way to store all the 406 currencies within the app. Is using the AppName-Prefix.pch useful for this? Or should I use a plist?
How should I load all these currencies in a dictionary with the identifier as the key?
I don't think loading each and every identifier using code will be an efficient way?
Instead of using this way of showing all currencies to the user, is there any better way from the Apple or 3rd party API which provides us a list of all the currencies in circulation?
Just showing all the currency options to the user to select one seems like too much work...
Apple should include another Picker view just like they have for Date Picker which is just for currencies.
One way to go about this is using CoreData.
Save all of them in Data Base,with the currencyList as entity and currencyName, Country, Currency ID as Attributes. perform a fetch request when user performs a query. Display just the required currency details

Store Currency code along with price

I am storing a price in my database.
I figured I should store the currency as my application with need to support internationalisation.
I believe the correct way is to store the ISO 4217 currency code, such as USD for US$, AUD for AU$ and EUR for Euros ...
I have a price and a currency attribute in model... Am I doing it right?
How do convert the currency code to it Symbol version? is there a helper for this? do I need to create myself a corresponding hash?
Cheers,
Joel
You should have a look at the Money gem. Handles currency codes and has support for exchange rates and formatting.
https://github.com/RubyMoney/money

Resources