You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Amounts in Open Payments define monetary values using asset codes, asset scales, and specific amount types. They provide a standardized way to represent money across different currencies and payment scenarios.
14
+
Amounts in Open Payments define monetary values using asset codesand asset scales. They provide a standardized way to represent money across different currencies and payment scenarios.
15
15
:::
16
16
17
-
Amounts represent monetary values and are fundamental to all payment operations. Every amount consists of three key components: a numerical `value`, an `assetCode`, and an `assetScale`. Understanding these components is crucial for building Open Payments applications.
17
+
Amounts represent monetary values and are fundamental to every Open Payments operation. Whether you're creating an incoming payment, requesting a quote, or tracking payment progress, every amount consists of three key components: a numerical `value`, an `assetCode`, and an `assetScale`. Understanding these components is crucial for building Open Payments applications.
18
18
19
-
Amounts are central to every Open Payments operation. Whether you're creating an incoming payment, requesting a quote, or tracking payment progress, all amounts follow the same three-part structure:
19
+
## Values
20
20
21
-
```json
22
-
{
23
-
"value": "1000",
24
-
"assetCode": "USD",
25
-
"assetScale": 2
26
-
}
27
-
```
21
+
To maximize precision and avoid rounding errors in financial calculations, Open Payments uses numerical data types without decimals to represent values. In the context of programming languages, this means that Open Payments uses unsigned 64-bit integers for monetary amounts instead of floating-point numbers.
28
22
29
-
This consistent structure enables multi-currency payments, precise calculations, and seamless integration between different <Tooltipcontent="Account servicing entity">ASEs</Tooltip>.
30
-
31
-
:::note[Wallet address asset constraint]
32
-
[Wallet addresses](/concepts/wallet-addresses) support only one specific asset. Therefore, the amounts that can be sent or received by a particular wallet address will only be in the asset supported by that wallet. For example, a USD wallet address can only accept amounts with `assetCode: "USD"`.
33
-
:::
23
+
An example of a value is the number 10000.
34
24
35
25
## Asset codes
36
26
37
27
Asset codes identify the type of currency or asset being used in a payment and should follow the <LinkOuthref='https://en.wikipedia.org/wiki/ISO_4217'>ISO 4217</LinkOut> standard for currency representation.
38
28
39
-
### Common currency examples
40
-
41
-
<tablestyle='width: auto; margin: 1;'>
42
-
<thead>
43
-
<tr>
44
-
<th>Asset Code</th>
45
-
<th>Currency</th>
46
-
<th>Symbol</th>
47
-
</tr>
48
-
</thead>
49
-
<tbody>
50
-
<tr>
51
-
<td>
52
-
<code>USD</code>
53
-
</td>
54
-
<td>US Dollar</td>
55
-
<td>$</td>
56
-
</tr>
57
-
<tr>
58
-
<td>
59
-
<code>EUR</code>
60
-
</td>
61
-
<td>Euro</td>
62
-
<td>€</td>
63
-
</tr>
64
-
<tr>
65
-
<td>
66
-
<code>GBP</code>
67
-
</td>
68
-
<td>British Pound</td>
69
-
<td>£</td>
70
-
</tr>
71
-
<tr>
72
-
<td>
73
-
<code>JPY</code>
74
-
</td>
75
-
<td>Japanese Yen</td>
76
-
<td>¥</td>
77
-
</tr>
78
-
<tr>
79
-
<td>
80
-
<code>MXN</code>
81
-
</td>
82
-
<td>Mexican Peso</td>
83
-
<td>$</td>
84
-
</tr>
85
-
<tr>
86
-
<td>
87
-
<code>ZAR</code>
88
-
</td>
89
-
<td>South African Rand</td>
90
-
<td>R</td>
91
-
</tr>
92
-
<tr>
93
-
<td>
94
-
<code>JOD</code>
95
-
</td>
96
-
<td>Jordanian Dinar</td>
97
-
<td>د.ا</td>
98
-
</tr>
99
-
</tbody>
100
-
</table>
101
-
102
-
When building payment applications, you'll specify the asset code to indicate which currency you're working with:
103
-
104
-
```json
105
-
{
106
-
"assetCode": "USD",
107
-
"assetScale": 2,
108
-
"value": "1000"
109
-
}
110
-
```
29
+
An example of an ISO 4217 `assetCode` is `USD`, which represents the US Dollar.
111
30
112
31
## Asset scales
113
32
114
-
<<<<<<<HEAD
115
33
An asset scale tells you how many decimal places a currency uses. It's like specifying whether you're counting in dollars, cents, or smaller units.
116
34
117
35
Asset scales are numbers between 0 and 255 that indicate decimal precision.
118
36
119
37
In the case of `USD` with an `assetScale` of 2, the display amount of $100.00 is stored and represented as 10000 cents.
Using the three necessary components of `value`, `assetCode`, and `assetScale`, $100 USD would be represented in Open Payments using the following structure:
129
+
130
+
```json
131
+
{
132
+
"value": "10000",
133
+
"assetCode": "USD",
134
+
"assetScale": 2
135
+
}
136
+
```
137
+
138
+
This consistent structure enables multi-currency payments, precise calculations, and seamless integration between different <Tooltipcontent="Account servicing entity">ASEs</Tooltip>.
0 commit comments