0.2.27 • Published 2 days ago

@packetpay/js v0.2.27

Weekly downloads
-
License
Open BSV License
Repository
github
Last release
2 days ago

@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 URL
  • fetchConfig 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 Authrite
    • config.ninjaConfig Object? Constructor parameters for Ninja
    • config.clientPrivateKey String? Client private key, used with both Authrite and Ninja if provided
    • config.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.

0.2.27

2 days ago

0.2.26

6 days ago

0.2.25

6 days ago

0.2.24

8 days ago

0.2.23

15 days ago

0.2.22

17 days ago

0.2.21

26 days ago

0.2.20

28 days ago

0.2.19

28 days ago

0.2.18

29 days ago

0.2.17

1 month ago

0.2.16

1 month ago

0.2.15

1 month ago

0.2.14

1 month ago

0.2.13

1 month ago

0.2.12

1 month ago

0.2.11

1 month ago

0.2.10

2 months ago

0.2.9

2 months ago

0.2.7

2 months ago

0.2.8

2 months ago

0.2.6

2 months ago

0.2.5

2 months ago

0.2.4

2 months ago

0.2.1

2 months ago

0.2.0

2 months ago

0.2.3

2 months ago

0.2.2

2 months ago

0.1.49

2 months ago

0.1.47

2 months ago

0.1.48

2 months ago

0.1.46

3 months ago

0.1.44

3 months ago

0.1.45

3 months ago

0.1.43

3 months ago

0.1.41

3 months ago

0.1.42

3 months ago

0.1.40

3 months ago

0.1.39

3 months ago

0.1.38

3 months ago

0.1.37

3 months ago

0.1.34

3 months ago

0.1.35

3 months ago

0.1.36

3 months ago

0.1.33

3 months ago

0.1.32

4 months ago

0.1.30

4 months ago

0.1.31

4 months ago

0.1.28

4 months ago

0.1.29

4 months ago

0.1.27

4 months ago

0.1.26

4 months ago

0.1.25

4 months ago

0.1.24

4 months ago

0.1.23

5 months ago

0.1.22

5 months ago

0.1.21

5 months ago

0.1.20

5 months ago

0.1.19

5 months ago

0.1.17

5 months ago

0.1.18

5 months ago

0.1.15

5 months ago

0.1.16

5 months ago

0.1.14

5 months ago

0.1.11

6 months ago

0.1.12

5 months ago

0.1.9

8 months ago

0.1.8

12 months ago

0.1.7

1 year ago

0.1.6

1 year ago

0.1.5

1 year ago

0.1.4

1 year ago

0.1.3

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago