Skip to content

Commit 24014a7

Browse files
authored
Update specification.md
Adding examples for XRP
1 parent fe99b46 commit 24014a7

File tree

1 file changed

+134
-24
lines changed

1 file changed

+134
-24
lines changed

v2/specification.md

+134-24
Original file line numberDiff line numberDiff line change
@@ -40,53 +40,81 @@ A list of payment options will be returned.
4040

4141
```
4242
{
43-
"time": "2019-06-13T18:07:33.495Z",
44-
"expires": "2019-06-13T18:22:33.495Z",
45-
"memo": "Payment request for BitPay invoice R4GvGy1ZbZhLWxcHq4u2hm for merchant Micah's Cool Store",
46-
"paymentUrl": "https://mriggan.bp:8088/i/R4GvGy1ZbZhLWxcHq4u2hm",
47-
"paymentId": "R4GvGy1ZbZhLWxcHq4u2hm",
43+
"time": "2020-01-24T18:57:44.509Z",
44+
"expires": "2020-01-24T19:12:44.509Z",
45+
"memo": "Payment request for BitPay invoice AonN46AuFPYTC8PKG8cPPV for merchant BitPay Visa® Load (USD-USA)",
46+
"paymentUrl": "https://bitpay.com/i/AonN46AuFPYTC8PKG8cPPV",
47+
"paymentId": "AonN46AuFPYTC8PKG8cPPV",
4848
"paymentOptions": [
4949
{
5050
"chain": "BTC",
5151
"currency": "BTC",
52-
"network": "regtest",
53-
"estimatedAmount": 15100,
54-
"decimals": 8
52+
"network": "main",
53+
"estimatedAmount": 13400,
54+
"requiredFeeRate": 6.544,
55+
"minerFee": 1600,
56+
"decimals": 8,
57+
"selected": false
5558
},
5659
{
5760
"chain": "BCH",
5861
"currency": "BCH",
59-
"network": "regtest",
60-
"estimatedAmount": 240800,
61-
"decimals": 8
62+
"network": "main",
63+
"estimatedAmount": 315200,
64+
"requiredFeeRate": 1,
65+
"minerFee": 0,
66+
"decimals": 8,
67+
"selected": false
6268
},
6369
{
6470
"chain": "ETH",
6571
"currency": "ETH",
66-
"network": "regtest",
67-
"estimatedAmount": 3864000000000000,
68-
"decimals": 18
72+
"network": "main",
73+
"estimatedAmount": 6195000000000000,
74+
"requiredFeeRate": 13555555557,
75+
"minerFee": 0,
76+
"decimals": 18,
77+
"selected": false
6978
},
7079
{
7180
"chain": "ETH",
7281
"currency": "GUSD",
73-
"network": "regtest",
82+
"network": "main",
7483
"estimatedAmount": 100,
75-
"decimals": 2
84+
"requiredFeeRate": 13555555557,
85+
"minerFee": 0,
86+
"decimals": 2,
87+
"selected": false
88+
},
89+
{
90+
"chain": "ETH",
91+
"currency": "PAX",
92+
"network": "main",
93+
"estimatedAmount": 1000000000000000000,
94+
"requiredFeeRate": 13555555557,
95+
"minerFee": 0,
96+
"decimals": 18,
97+
"selected": false
7698
},
7799
{
78100
"chain": "ETH",
79101
"currency": "USDC",
80-
"network": "regtest",
102+
"network": "main",
81103
"estimatedAmount": 1000000,
82-
"decimals": 6
104+
"requiredFeeRate": 13555555557,
105+
"minerFee": 0,
106+
"decimals": 6,
107+
"selected": false
83108
},
84109
{
85-
"chain": "ETH",
86-
"currency": "PAX",
87-
"network": "regtest",
88-
"estimatedAmount": 1000000000000000000,
89-
"decimals": 18
110+
"chain": "XRP",
111+
"currency": "XRP",
112+
"network": "main",
113+
"estimatedAmount": 4494841,
114+
"requiredFeeRate": 12,
115+
"minerFee": 0,
116+
"decimals": 6,
117+
"selected": true
90118
}
91119
]
92120
}
@@ -238,6 +266,32 @@ A POST request should be made to the payment protocol url with a JSON dictionary
238266
}
239267
```
240268

269+
#### XRP Response
270+
```
271+
{
272+
"time": "2020-01-24T18:57:44.509Z",
273+
"expires": "2020-01-24T19:12:44.509Z",
274+
"memo": "Payment request for BitPay invoice AonN46AuFPYTC8PKG8cPPV for merchant BitPay Visa® Load (USD-USA)",
275+
"paymentUrl": "https://bitpay.com/i/AonN46AuFPYTC8PKG8cPPV",
276+
"paymentId": "AonN46AuFPYTC8PKG8cPPV",
277+
"chain": "XRP",
278+
"network": "main",
279+
"instructions": [
280+
{
281+
"type": "transaction",
282+
"requiredFeeRate": 12,
283+
"outputs": [
284+
{
285+
"amount": 4494841,
286+
"invoiceID": "326661FF10DF1F00B10DD96D58B4D026FB32CBF2E8DF5D3E22716092AAD4F082",
287+
"address": "rKpTKoJSFbCoZkwydRv7NWTiBgNrdTXJ24"
288+
}
289+
]
290+
}
291+
]
292+
}
293+
```
294+
241295
#### Headers
242296
On a successful request, the response will contain the following headers.
243297

@@ -329,6 +383,35 @@ A 200 return code means that the transaction is valid. Additional fields are av
329383
}
330384
```
331385

386+
#### Example XRP Body
387+
```
388+
{
389+
"chain": "XRP",
390+
"currency": "XRP",
391+
"transactions": [
392+
{
393+
"tx": "120000228000000024000000095011F6751F266C7E664CB3CDAE77D091ED73E3D365591D8FA769BEA9F694C5C4A5DF614000000000448E1768400000000000000C81148FF291E50F16A206B96D383E1F86CC47E21727DA8314C5B8A782192BFF4D8FF629A88BEEB417A4D9EEB2"
394+
}
395+
]
396+
}
397+
```
398+
399+
#### Example XRP Response
400+
```
401+
{
402+
"payment": {
403+
"currency": "XRP",
404+
"chain": "XRP",
405+
"transactions": [
406+
{
407+
"tx": "120000228000000024000000095011F6751F266C7E664CB3CDAE77D091ED73E3D365591D8FA769BEA9F694C5C4A5DF614000000000448E1768400000000000000C81148FF291E50F16A206B96D383E1F86CC47E21727DA8314C5B8A782192BFF4D8FF629A88BEEB417A4D9EEB2"
408+
}
409+
]
410+
},
411+
"memo": "Payment appears valid"
412+
}
413+
```
414+
332415

333416
## Payment
334417
Now that the server has told us our payment is acceptable, we can send the fully signed transaction.
@@ -369,10 +452,24 @@ A POST request should be made to the payment protocol url with `{chain, transact
369452
}
370453
```
371454

455+
456+
#### Example XRP Request Body
457+
```
458+
{
459+
"chain": "XRP",
460+
"currency": "XRP",
461+
"transactions": [
462+
{
463+
"tx": "120000228000000024000000095011F6751F266C7E664CB3CDAE77D091ED73E3D365591D8FA769BEA9F694C5C4A5DF614000000000448E1768400000000000000C7321030834A2B07BD552337FEA00C32E8DDDDB541BC7353DA7E982B4C191BFE432D3BE74473045022100A2D1E2A0B0E01EAAA36F67F650463391E4390F9F540D4C7553E1698F866A16E002201C5CB68137805ECC73F2D4459E7840842C255065A716475CDDFCA007EA570A1581148FF291E50F16A206B96D383E1F86CC47E21727DA8314C5B8A782192BFF4D8FF629A88BEEB417A4D9EEB2"
464+
}
465+
]
466+
}
467+
```
468+
372469
### Response
373470
The response will be a JSON format payload containing the original payment body and a memo field which should be displayed to the user.
374471

375-
#### Response Example
472+
#### ETH - GUSD Response Example
376473
```JSON
377474
{
378475
"payment": {
@@ -388,6 +485,19 @@ The response will be a JSON format payload containing the original payment body
388485
"memo": "Transaction received by BitPay. Invoice will be marked as paid if the transaction is confirmed."
389486
}
390487
```
488+
#### XRP Response Example
489+
```
490+
{
491+
"payment": {
492+
"transactions": [
493+
{
494+
"tx": "120000228000000024000000095011F6751F266C7E664CB3CDAE77D091ED73E3D365591D8FA769BEA9F694C5C4A5DF614000000000448E1768400000000000000C7321030834A2B07BD552337FEA00C32E8DDDDB541BC7353DA7E982B4C191BFE432D3BE74473045022100A2D1E2A0B0E01EAAA36F67F650463391E4390F9F540D4C7553E1698F866A16E002201C5CB68137805ECC73F2D4459E7840842C255065A716475CDDFCA007EA570A1581148FF291E50F16A206B96D383E1F86CC47E21727DA8314C5B8A782192BFF4D8FF629A88BEEB417A4D9EEB2"
495+
}
496+
]
497+
},
498+
"memo": "Transaction received by BitPay. Invoice will be marked as paid if the transaction is confirmed."
499+
}
500+
```
391501

392502
## Signatures
393503

0 commit comments

Comments
 (0)