Catalog npm
Back to packageRELEASE DETAILS

0.0.2

npm

402

402 payments

402payments
Published20 May 2016
Direct dependencies10
Transitive dependenciesNot calculated

README

Current package documentation

Introduction

Note: This repository contains experimental work from 2016 implementing HTTP 402 with Solid. We are now exploring modern HTTP 402 implementations and standards for R&D purposes.

For today's hackday I am going to try and start to build an access controlled "route" in solid-server, which grants access to a resource based on a credit system. If you have credits, it will show you the resource. If not you will get a 402. This builds a bit more functionality on the code written for the previous hack day. I'll try and incorporate the work from the web payments WG http://w3c.github.io/webpayments-http-api/.

Modern HTTP 402 Implementations (2025)

The HTTP 402 "Payment Required" status code, long dormant since HTTP/1.1, has seen significant adoption in 2025. Here are notable projects and standards:

x402 Protocol

  • Description: Open protocol by Coinbase that enables blockchain-based payments over HTTP
  • Partners: Cloudflare, Visa, Google, AWS, Anthropic, Circle, Vercel
  • Documentation: https://x402.gitbook.io/x402/core-concepts/client-server
  • Foundation: x402 Foundation (Coinbase + Cloudflare)
  • Use Cases: AI agent payments, API monetization, autonomous commerce
  • Stats: 1.38M+ transactions, $1.48M+ volume (as of Oct 2025)

Cloudflare Pay Per Crawl

  • Description: HTTP 402 implementation for AI crawler monetization
  • Documentation: https://developers.cloudflare.com/agents/x402/
  • Features: Per-request pricing for AI bots accessing web content
  • Scale: 1 billion+ HTTP 402 responses daily

L402 Protocol (Lightning Labs)

  • Aperture: L402 reverse HTTP proxy for paid APIs
  • @bus402/x402-sandbox: NPM package for local x402 testing
  • Visa TAP: Trusted Agent Protocol supporting x402
  • PING Token: First token experiment on x402 protocol (Base chain)

Resources

Components

The demo contains 4 components

  • /pay -- the resource that costs 25 credits to view
  • /balance -- shows your balance
  • /faucet -- a small app that will see your balance
  • /home -- navigation and instructions

Each was deployed as a custom route with its own handler.

Installation

Installation is via

git clone https://github.com/melvincarvalho/402.git

Then run

npm install
$ bin/server.js  --port 8443 --ssl-key path/to/ssl-key.pem --ssl-cert path/to/ssl-cert.pem
# server running on https://localhost:8443/
How do I get the --ssl-key and the --ssl-cert?

You need an SSL certificate you get this from your domain provider or for free from Let's Encrypt!.

If you don't have one yet, or you just want to test solid, generate a certificate

$ openssl genrsa 2048 > ../localhost.key
$ openssl req -new -x509 -nodes -sha256 -days 3650 -key ../localhost.key -subj '/CN=*.localhost' > ../localhost.cert

Faucet

Using webcredits it is possible to set up a faucet using

credit create

credit genesis

credit insert https://w3id.org/cc#coinbase 50000 '' https://w3id.org/cc#faucet

Demo

Demo

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Declared dependencies 10

Native requirements
10 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
cors
Environment
{
  "local_name": "cors",
  "alias": false,
  "peer_metadata": null
}
^2.7.1runtime
vhost
Environment
{
  "local_name": "vhost",
  "alias": false,
  "peer_metadata": null
}
^3.0.2runtime
webid
Environment
{
  "local_name": "webid",
  "alias": false,
  "peer_metadata": null
}
^0.3.7runtime
express
Environment
{
  "local_name": "express",
  "alias": false,
  "peer_metadata": null
}
^4.13.4runtime
commander
Environment
{
  "local_name": "commander",
  "alias": false,
  "peer_metadata": null
}
^2.9.0runtime
sequelize
Environment
{
  "local_name": "sequelize",
  "alias": false,
  "peer_metadata": null
}
^3.23.2runtime
dateformat
Environment
{
  "local_name": "dateformat",
  "alias": false,
  "peer_metadata": null
}
^1.0.12runtime
http-error
Environment
{
  "local_name": "http-error",
  "alias": false,
  "peer_metadata": null
}
0.0.6runtime
body-parser
Environment
{
  "local_name": "body-parser",
  "alias": false,
  "peer_metadata": null
}
^1.15.1runtime
express-session
Environment
{
  "local_name": "express-session",
  "alias": false,
  "peer_metadata": null
}
^1.13.0runtime

Distribution files

1 collected
Distribution 1

Source distribution

Source file
Checksums from source
{
  "shasum": "956758ed6a577932a2073ff8c150963ab6437476",
  "tarball": "https://registry.npmjs.org/402/-/402-0.0.2.tgz",
  "integrity": "sha512-IepsIi90PBYwC38JoZ/3Tao/9OTHsWBZ7+pUISPBv1+3TjHNODRMTpu0I+zUFTJGtzrBRYXOHJvQJpmcP2qamQ==",
  "signatures": [
    {
      "sig": "MEYCIQC2CIYsOwxh+XOdIgKAk9UImioz4BkO2H4RCmYbUwqqvQIhAMjzDRdC0ieiC6TzzCK9fryc/DBC7SAIML3Kn92spq2N",
      "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"
    }
  ]
}

Repository

PENDING
melvincarvalho/402

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 19:57 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package_version:a3e91b5c8409cdf55f6fbdda48af3f78b6d0db81287335db09e1027b16a4a74a

Other collected versions

0.1.127 Oct0.1.021 May0.0.621 May0.0.521 May0.0.320 MayView all collected versions →