@packetpay/js v0.2.36
@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/jsExample 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
urlString The request URLfetchConfigObject? The fetch configuration object (optional, default{})configObject? PacketPay configuration object, optional of Babbage SDK is used (optional, default{})config.authriteConfigObject? Constructor parameters for Authriteconfig.ninjaConfigObject? Constructor parameters for Ninjaconfig.clientPrivateKeyString? Client private key, used with both Authrite and Ninja if providedconfig.descriptionString? 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.
1 year 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
1 year ago
1 year ago
1 year ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago