forked from bitpay/bitcore-payment-protocol
-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update documentation #15
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
ebaccb8
Add a proper gitignore
nmarley 5a2bf1c
Update package author
nmarley c01b82a
Cleanup README a bit
nmarley 00b9cb0
Add publish instructions to README
nmarley 18da684
Dashify documentation and remove bower references
nmarley b426512
Use the @dashevo npm namespace
nmarley 6cd5916
Use @dashevo namespace in docs/index.md
nmarley File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,9 @@ | ||
*.sw[a-z] | ||
coverage | ||
# do not track dependencies | ||
node_modules | ||
bitcore-payment-protocol.js | ||
bitcore-payment-protocol.min.js | ||
tests.js | ||
|
||
lib/errors/index.js | ||
npm-debug.log | ||
|
||
bower_components | ||
report | ||
.DS_Store | ||
# ignore generated code coverage output | ||
coverage | ||
.nyc_output | ||
|
||
.idea/ | ||
# ignore build artifacts | ||
dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,22 @@ | ||
# Payment Protocol | ||
|
||
`PaymentProtocol` and associated functions and methods will serialize, deserialize, sign and verify payment protocol messages both in Node.js and web browsers. Both X.509 and [bitcoin identity protocol](https://en.bitcoin.it/wiki/Identity_protocol_v1) are supported. For detailed technical information, please view [BIP70](https://github.com/bitcoin/bips/blob/master/bip-0070.mediawiki). | ||
|
||
## Installation | ||
Payment protocol is implemented as a separate module and you must add it to your dependencies: | ||
|
||
For node projects: | ||
|
||
``` | ||
npm install bitcore-lib --save | ||
npm install bitcore-payment-protocol --save | ||
``` | ||
|
||
For client-side projects: | ||
Payment protocol is implemented as a separate module and you must add it to your dependencies: | ||
|
||
``` | ||
bower install bitcore-lib --save | ||
bower install bitcore-payment-protocol --save | ||
npm install @dashevo/dashcore-lib | ||
npm install @dashevo/dashcore-payment-protocol | ||
``` | ||
|
||
## Make Payment Details | ||
|
||
Here the merchant's server will construct the payment details message: | ||
|
||
```javascript | ||
var PaymentProtocol = require('bitcore-payment-protocol'); | ||
var PaymentProtocol = require('@dashevo/dashcore-payment-protocol'); | ||
var now = Date.now() / 1000 | 0; | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
// construct the payment details | ||
|
@@ -39,6 +33,7 @@ details.set('merchant_data', new Buffer({size: 7})); // identify the request | |
For more information about these fields please visit [BIP70](https://github.com/bitcoin/bips/blob/master/bip-0070.mediawiki#paymentdetailspaymentrequest) | ||
|
||
## Sign a Payment Request | ||
|
||
The merchant's server will then construct a payment request and send it to the customer: | ||
|
||
```javascript | ||
|
@@ -64,6 +59,7 @@ var rawbody = request.serialize(); | |
``` | ||
|
||
## Verify a Payment Request | ||
|
||
The customers wallet would then verify the payment request as follows (after asking for the payment request message): | ||
|
||
```javascript | ||
|
@@ -99,6 +95,7 @@ var merchant_data = details.get('merchant_data'); | |
``` | ||
|
||
## Send a Payment | ||
|
||
After the request is verified a payment can be sent to the merchant from the customer's wallet: | ||
|
||
```javascript | ||
|
@@ -130,6 +127,7 @@ var rawbody = pay.serialize(); | |
``` | ||
|
||
## Receive a Payment | ||
|
||
The merchant would then receive the payment as follows: | ||
|
||
```javascript | ||
|
@@ -141,10 +139,11 @@ var transactions = payment.get('transactions'); | |
var refund_to = payment.get('refund_to'); | ||
var memo = payment.get('memo'); | ||
|
||
// send the transaction to the bitcoin network | ||
// send the transaction to the Dash network | ||
``` | ||
|
||
## Send a Payment Acknowledgement | ||
|
||
After the payment has been broadcasted, a payment acknowledgement can be sent in response: | ||
|
||
```javascript | ||
|
@@ -162,6 +161,7 @@ var rawbody = ack.serialize(); | |
``` | ||
|
||
## Receive an Acknowledgement | ||
|
||
The customer's wallet can then receive an acknowledgement of payment as follows: | ||
|
||
```javascript | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.