`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).
```javascript
var bitcore = require('bitcore');
var PaymentProtocol = bitcore.PaymentProtocol;
```
## Make Payment Details
Here the merchant's server will construct the payment details message:
```javascript
var now = Date.now() / 1000 | 0;
// construct the payment details
var details = new PaymentProtocol().makePaymentDetails();
details.set('network', 'test');
details.set('outputs', outputs);
details.set('time', now);
details.set('expires', now + 60 * 60 * 24);
details.set('memo', 'A payment request from the merchant.');
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
// load the X509 certificate
var certificates = new PaymentProtocol().makeX509Certificates();
For detailed diagram of the exchange of messages, please see the [Protocol section of BIP70](https://github.com/bitcoin/bips/blob/master/bip-0070.mediawiki#protocol).