Skip to content

Commit 29d3ca7

Browse files
committed
Adding more examples for different currencies
1 parent 1d7571a commit 29d3ca7

File tree

1 file changed

+53
-6
lines changed

1 file changed

+53
-6
lines changed

v2/specification.md

+53-6
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,9 @@ Each payment option includes
8585

8686
### Request
8787
A GET request should be made to the payment protocol url with ?chain=chain&currency=currency
88-
Examples:
88+
89+
#### Examples:
90+
8991
* /i/:someinvoiceid?chain=BTC
9092
* /i/:someinvoiceid?chain=ETH
9193
* /i/:someinvoiceid?chain=ETH&currency=GUSD
@@ -185,7 +187,7 @@ A POST request should be made to the i/:invoiceid/verify payment protocol url. A
185187
}
186188
```
187189

188-
#### Example Request Body
190+
#### Example BTC/BCH Body
189191
```JSON
190192
{
191193
"chain": "BTC",
@@ -196,6 +198,29 @@ A POST request should be made to the i/:invoiceid/verify payment protocol url. A
196198
}
197199
```
198200

201+
#### Example ETH Request Body
202+
```JSON
203+
{
204+
"chain": "ETH",
205+
"unsignedTransactions": [
206+
"0200000001919572700aef4a9b66ac2389ea8e8899b1c2c0b3ffe03c12c2d28e7a2574d3540100000000feffffff02c80f5f91000000001976a9140cd9a12aa54ad7b098988c67692a62196c1dbdc988ac98470200000000001976a9140f8cf402ad6478377750d572089d1e1a3ca099a788ac00000000"
207+
]
208+
}
209+
```
210+
211+
212+
#### Example ETH-GUSD Request Body
213+
```JSON
214+
{
215+
"chain":"ETH",
216+
"currency": "GUSD",
217+
"unsignedTransactions":[
218+
"0200000001919572700aef4a9b66ac2389ea8e8899b1c2c0b3ffe03c12c2d28e7a2574d3540100000000feffffff02c80f5f91000000001976a9140cd9a12aa54ad7b098988c67692a62196c1dbdc988ac98470200000000001976a9140f8cf402ad6478377750d572089d1e1a3ca099a788ac00000000",
219+
"0200000001919572700aef4a9b66ac2389ea8e8899b1c2c0b3ffe03c12c2d28e7a2574d3540100000000feffffff02c80f5f91000000001976a9140cd9a12aa54ad7b098988c67692a62196c1dbdc988ac98470200000000001976a9140f8cf402ad6478377750d572089d1e1a3ca099a788ac00000000"
220+
]
221+
}
222+
```
223+
199224
### Curl Example
200225
```
201226
curl -v -d '{"chain": "BTC", "unsignedTransactions": ["0200000001919572700aef4a9b66ac2389ea8e8899b1c2c0b3ffe03c12c2d28e7a2574d3540100000000feffffff02c80f5f91000000001976a9140cd9a12aa54ad7b098988c67692a62196c1dbdc988ac98470200000000001976a9140f8cf402ad6478377750d572089d1e1a3ca099a788ac00000000"], "weightedSizes":[225]}' https://test.bitpay.com/i/YFujEPNdx8WGEUsysjdLfa/verify
@@ -224,7 +249,7 @@ curl -v -d '{"chain": "BTC", "unsignedTransactions": ["0200000001919572700aef4a9
224249
Now that the server has told us our payment is acceptable, we can send the fully signed transaction.
225250

226251
### Request
227-
A POST request should be made to the payment protocol url with a `Content-Type` header set to `application/payment`. A JSON format body should be included with the following fields:
252+
A POST request should be made to /i/:invoice/pay . A JSON format body should be included with the following fields:
228253

229254
```JSON
230255
{
@@ -236,7 +261,7 @@ A POST request should be made to the payment protocol url with a `Content-Type`
236261
}
237262
```
238263

239-
#### Example Request Body
264+
#### Example BTC/BCH Request Body
240265
```JSON
241266
{
242267
"chain": "BTC",
@@ -246,6 +271,28 @@ A POST request should be made to the payment protocol url with a `Content-Type`
246271
}
247272
```
248273

274+
#### Example ETH Request Body
275+
```JSON
276+
{
277+
"chain": "BTC",
278+
"transactions": [
279+
"02000000011f0f762184cbc8e94b307fab6f805168724f123a23cd48aac4a9bac8768cfd67000000004847304402205079b96def679f04de9698dd8b9f58dff3e4a13c075f5939c6edfbb8698c8cc802203eac5a3d6410a9f94a86828a4e207f8083fe0bf1c77a74a0cb7add49100d427001ffffffff0284990000000000001976a9149097a519e42061e4977b07b69735ed842b755c0088ac08cd042a010000001976a914cf4b90bca14deab1315c125b8b74b7d31eea97b288ac00000000"
280+
]
281+
}
282+
```
283+
284+
#### Example ETH-GUSD Request Body
285+
```JSON
286+
{
287+
"chain":"ETH",
288+
"currency": "GUSD",
289+
"transactions":[
290+
"0200000001919572700aef4a9b66ac2389ea8e8899b1c2c0b3ffe03c12c2d28e7a2574d3540100000000feffffff02c80f5f91000000001976a9140cd9a12aa54ad7b098988c67692a62196c1dbdc988ac98470200000000001976a9140f8cf402ad6478377750d572089d1e1a3ca099a788ac00000000",
291+
"0200000001919572700aef4a9b66ac2389ea8e8899b1c2c0b3ffe03c12c2d28e7a2574d3540100000000feffffff02c80f5f91000000001976a9140cd9a12aa54ad7b098988c67692a62196c1dbdc988ac98470200000000001976a9140f8cf402ad6478377750d572089d1e1a3ca099a788ac00000000"
292+
]
293+
}
294+
```
295+
249296
### Response
250297
The response will be a JSON format payload containing the original payment body and a memo field which should be displayed to the user.
251298

@@ -263,7 +310,7 @@ The response will be a JSON format payload containing the original payment body
263310

264311
### Curl Example
265312
```
266-
curl -v -H 'Content-Type: application/payment' -d '{"currency": "BTC", "transactions":["02000000012319227d3995427b05429df7ea30b87cb62f986ba3003311a2cf2177fb5b0ae8000000004847304402205bd75d6b654a70dcc8f548b630c39aec1d2c1de6900b5376ef607efc705f65b002202dd1036f091d4d6047e2f5bcd230ec8bcd5ad2f0785908d78f08a52b8850559f01ffffffff02b09a0000000000001976a9140b2a833c4183c51b86f5dcbb2eeeaca2dfb44bae88acdccb042a010000001976a914f0fd63e5880cbed2fa856e1f4174fc875eeccc5a88ac00000000"]}' https://test.bitpay.com/i/7QBCJ2TpazTKKnczzJQJMc
313+
curl -v -d '{"currency": "BTC", "transactions":["02000000012319227d3995427b05429df7ea30b87cb62f986ba3003311a2cf2177fb5b0ae8000000004847304402205bd75d6b654a70dcc8f548b630c39aec1d2c1de6900b5376ef607efc705f65b002202dd1036f091d4d6047e2f5bcd230ec8bcd5ad2f0785908d78f08a52b8850559f01ffffffff02b09a0000000000001976a9140b2a833c4183c51b86f5dcbb2eeeaca2dfb44bae88acdccb042a010000001976a914f0fd63e5880cbed2fa856e1f4174fc875eeccc5a88ac00000000"]}' https://test.bitpay.com/i/7QBCJ2TpazTKKnczzJQJMc/pay
267314
* Trying 127.0.0.1...
268315
* TCP_NODELAY set
269316
* Connected to test.bitpay.com (127.0.0.1) port 443 (#0)
@@ -430,7 +477,7 @@ All errors are communicated in plaintext with an appropriate status code.
430477
### Example Error
431478

432479
```
433-
curl -v https://test.bitpay.com/i/48gZau8ao76bqAoEwAKSwx -H 'Accept: application/payment-request'
480+
curl -v https://test.bitpay.com/i/48gZau8ao76bqAoEwAKSwx
434481
* Trying 104.17.68.20...
435482
* TCP_NODELAY set
436483
* Connected to test.bitpay.com (104.17.68.20) port 443 (#0)

0 commit comments

Comments
 (0)