@packetpay/js v0.2.27
@packetpay/js
A fetch client capable of paying for its requests
The code is available on GitHub and the package is published on NPM.
Overview
PacketPay is a system for making HTTP requests monetized using BSV micropayments.
The PacketPay client makes a pre-flight request to the server endpoint. If a 402 error is encountered, the client pays the server for the request and the response is returned. If the server does not charge for the response, the response is retured as normal. The Babbage SDK is used for payment.
There is a complementary server middleware for accepting these payments.
Installation
npm i @packetpay/js
Example Usage
This example demonstrates a simple request with @packetpay/js
const PacketPay = require('@packetpay/js')
const newsArticle = await PacketPay(
'https://decent-news-site.com/article/2009/Jan/chancellor-on-brink.html'
)
API
Table of Contents
client
Parameters
url
String The request URLfetchConfig
Object? The fetch configuration object (optional, default{}
)config
Object? PacketPay configuration object, optional of Babbage SDK is used (optional, default{}
)config.authriteConfig
Object? Constructor parameters for Authriteconfig.ninjaConfig
Object? Constructor parameters for Ninjaconfig.clientPrivateKey
String? Client private key, used with both Authrite and Ninja if providedconfig.description
String? Payment description, if a non-default description is desired
Returns Promise[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object) Containing status
, headers
and body
License
The license for the code in this repository is the Open BSV License.
2 days ago
6 days ago
6 days ago
8 days ago
15 days ago
17 days ago
26 days ago
28 days ago
28 days ago
29 days ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
6 months ago
5 months ago
8 months ago
12 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago