[webpayments] PROPOSAL: Use strings to represent currency and amount per ISO20022 (#57)

This proposal addresses the question in #40.

The ISO20022 dictionary defines a CurrencyAndAmount [1] data type for passing currencies and amounts in payment messages (as well as some updated version thereof with looser restrictions on the number of digits allowed).

In ISO20022 currencies are represented using the ISO 4217 [2] three-letter alpha code.

The decimal separator is a dot.

An example of an ISO 20022 currency and amount in XML:
```xml
<Amt>
<InstdAmt Ccy="EUR">1.00</InstdAmt>
</Amt>
```
PROPOSAL:

Use formatting rules for the Web Payments WG specifications as follows:
 1. Amounts MUST be represented as an object.
 1. The amount object MUST have at least two named properties: "currency" and "amount".
 1. The value of the amount property MUST be a string consisting only of numeric digits.
 1. The value of the amount property MAY contain a single dot to denote separation of the fractional suffix from the rest of the amount.
 1. If present, the dot MUST NOT be the first character of the amount.
 1. The value of the currency property MUST be expressed as a string of 3 characters.
 1. If the currency is listed in the ISO 4217 Current Currency and Funds list the appropriate alpha currency code MUST be used. 
 1. If the currency is not listed in the ISO 4217 Current Currency and Funds list an appropriate and universally understood code SHOULD be used if available.

Example:

```js
{
  "amount" : "0.12345678"
  "currency" : "XBT"
}
```

[1] http://www.iso20022.org/standardsrepository/public/wqt/Description/mx/dico/datatypes/_L8ZcEp0gEeOo48XfssNw8w
[2] https://en.wikipedia.org/wiki/ISO_4217



---
Reply to this email directly or view it on GitHub:
https://github.com/w3c/webpayments/issues/57

Received on Tuesday, 19 January 2016 20:25:06 UTC