|
18 | 18 | "type": "payment", // MUST be "payment"
|
19 | 19 | "id": "PID-123", // Relay-unique Payment ID
|
20 | 20 | "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 |
22 | 22 | "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 |
23 | 25 | "vendor_icon": "https://example.com/..", // Vendor icon URL, JPG or PNG
|
24 | 26 | "vendor_name": "Vendor Co", // Vendor display name
|
25 | 27 | "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) |
31 | 34 | "items": [], // List of line items to display (Connect Items)
|
32 | 35 | "outputs": [], // List of outputs to pay (Connect Outputs)
|
33 | 36 | }
|
|
43 | 46 | "name": "Doge Plushie", // name to display
|
44 | 47 | "desc": "One doge plushie in a soft bag", // item description to display
|
45 | 48 | "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) |
48 | 52 | }
|
49 | 53 | ```
|
50 | 54 |
|
|
53 | 57 | ```json
|
54 | 58 | {
|
55 | 59 | "address": "DQ6dt7wCjLDxtdSwCYSAMFHwrD5Q1xybmL", // Dogecoin Address
|
56 |
| - "amount": "1.0", // Amount, DECMIAL string |
| 60 | + "amount": "1.0", // Amount, 8-DP string |
57 | 61 | }
|
58 | 62 | ```
|
59 | 63 |
|
| 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 | + |
60 | 76 | ## Payment Envelope Verification
|
61 | 77 |
|
62 | 78 | The DogeConnect _Payment Envelope_ contains a Base64-encoded JSON payload,
|
|
0 commit comments