Skip to content

Commit 4f7a972

Browse files
committed
added fee_per_kb, max_size, fiat_tax fields; renamed unit price
added 8-DP tag for Koinu decimals
1 parent 7053fd6 commit 4f7a972

File tree

1 file changed

+25
-9
lines changed

1 file changed

+25
-9
lines changed

src/payment_envelope/envelope.md

+25-9
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,19 @@
1818
"type": "payment", // MUST be "payment"
1919
"id": "PID-123", // Relay-unique Payment ID
2020
"issued": "2006-01-02T15:04:05-07:00", // RFC 3339 Timestamp
21-
"timeout": 60, // Timeout in seconds
21+
"timeout": 60, // Timeout in seconds, do not pay after this time
2222
"relay": "https://example.com/..", // Payment Relay to submit payment tx
23+
"fee_per_kb": "0.01001386", // Minimum fee per 1000 bytes in payment tx, 8-DP string
24+
"max_size": 10000, // Maximum size in bytes of payment tx
2325
"vendor_icon": "https://example.com/..", // Vendor icon URL, JPG or PNG
2426
"vendor_name": "Vendor Co", // Vendor display name
2527
"vendor_address": "123 Example St", // Vendor business address (optional)
26-
"total": "420.69", // Total amount including fees and taxes, DECMIAL string
27-
"fees": "1.0", // Fee subtotal, DECMIAL string
28-
"taxes": "5.31", // Taxes subtotal, DECMIAL string
29-
"fiat_total": "5.00", // Total in fiat currency, DECMIAL string (optional)
30-
"fiat_currency": "USD", // ISO 4217 currency code (required with fiat_total)
28+
"total": "41.9395", // Total including fees and taxes, 8-DP string
29+
"fees": "1.0", // Fees subtotal, 8-DP string
30+
"taxes": "1.9495", // Taxes subtotal, 8-DP string
31+
"fiat_total": "5.00", // Total in fiat currency, decimal string (optional)
32+
"fiat_tax": "0.23", // Taxes in fiat currency, decimal string (optional)
33+
"fiat_currency": "USD", // ISO 4217 currency code (required with fiat_total/fiat_tax)
3134
"items": [], // List of line items to display (Connect Items)
3235
"outputs": [], // List of outputs to pay (Connect Outputs)
3336
}
@@ -43,8 +46,9 @@
4346
"name": "Doge Plushie", // name to display
4447
"desc": "One doge plushie in a soft bag", // item description to display
4548
"count": 1, // number of units >= 1
46-
"cost": "414.38", // unit price, DECMIAL string
47-
"total": "414.38", // count x cost, DECMIAL string
49+
"unit": "38.99", // unit price, 8-DP string
50+
"total": "38.99", // count x unit, 8-DP string
51+
"tax": "1.9495", // tax on this item, 8-DP string (optional)
4852
}
4953
```
5054

@@ -53,10 +57,22 @@
5357
```json
5458
{
5559
"address": "DQ6dt7wCjLDxtdSwCYSAMFHwrD5Q1xybmL", // Dogecoin Address
56-
"amount": "1.0", // Amount, DECMIAL string
60+
"amount": "1.0", // Amount, 8-DP string
5761
}
5862
```
5963

64+
### 8-DP string
65+
66+
Fields marked `8-DP string` are DECIMAL numbers with up to 8 decimal places,
67+
which represent a Koinu value – the smallest unit of Dogecoin.
68+
69+
They are strings to preserve accuracy; most JSON parsers treat numbers as
70+
_floating point_, which sacrifices some accuracy (e.g. a value of "0.1" cannot
71+
be stored _accurately_ as a _floating point_ number.)
72+
73+
These can be parsed using a _Decimal_ library, or code like [this](https://github.com/dogeorg/dogeconnect-go/blob/main/koinu/parse.go).
74+
75+
6076
## Payment Envelope Verification
6177

6278
The DogeConnect _Payment Envelope_ contains a Base64-encoded JSON payload,

0 commit comments

Comments
 (0)