The definitions of standard_cost and actual_cost both reference "cents", and I think the assumption is that the cost will always be denominated in US dollars. However, if this spec becomes successful, it would be great to see it used in other countries. And this is not just a theoretical possibility: in August, Bird launched scooters in Paris, and Lime did so in Madrid.
I would suggest adding two extra fields to the /trips provider endpoint: standard_cost_currency and actual_cost_currency. Each of these fields would be an ISO4217 currency code like "USD" or "GBP".
Alternately, you could have standard_cost and actual_cost be sub-objects with two properties: amount and currency.
There is a catch, though, in that you will then need to store the currency amount either as a decimal amount, which can cause problems if it is parsed into a float, or as a fixed point number based on the currency's default number of fraction digits, which can be a little unwieldy. See https://github.com/zalando/jackson-datatype-money/blob/master/MONEY.md for a more thorough discussion of how to represent money in JSON.
The definitions of standard_cost and actual_cost both reference "cents", and I think the assumption is that the cost will always be denominated in US dollars. However, if this spec becomes successful, it would be great to see it used in other countries. And this is not just a theoretical possibility: in August, Bird launched scooters in Paris, and Lime did so in Madrid.
I would suggest adding two extra fields to the
/trips
provider endpoint:standard_cost_currency
andactual_cost_currency
. Each of these fields would be an ISO4217 currency code like "USD" or "GBP".Alternately, you could have
standard_cost
andactual_cost
be sub-objects with two properties:amount
andcurrency
.There is a catch, though, in that you will then need to store the currency amount either as a decimal amount, which can cause problems if it is parsed into a float, or as a fixed point number based on the currency's default number of fraction digits, which can be a little unwieldy. See https://github.com/zalando/jackson-datatype-money/blob/master/MONEY.md for a more thorough discussion of how to represent money in JSON.