Current collected state Current
Observed since 20 Oct, 19:57 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
A lightweight wrapper around axios that adds 402 Payment Required retry hooks and pluggable paywall handlers.
A tiny axios wrapper that adds HTTP 402 (Payment Required) handling via a pluggable callback.
npm install 402.js
# or
pnpm add 402.js
If you're publishing this yourself, run
npm publishinside this folder.
import { createClient } from "402.js";
const client = createClient({
maxRetries: 1,
onPaymentRequired: async ({ config, error, attempt }) => {
// TODO: trigger your payment flow here (Stripe, Solana, Pump.fun, etc.)
// Return true to retry the request after payment succeeds.
console.log("402 received; attempt:", attempt);
return false;
}
});
const res = await client.get("https://api.example.com/protected");
console.log(res.data);
createClient(options)maxRetries (default 1): number of times to retry after your payment callback returns true.onPaymentRequired(ctx) => Promise<boolean>: called when a response is 402. Return true to retry once payment succeeds.axiosConfig: passed to axios.create().Returns an object with { axios, get, post, put, patch, delete, request }.
MIT
Download counts and popularity will appear here as the collector receives them.
| Version | Published | Direct dependencies | Open version |
|---|---|---|---|
| 1.0.0Registry latest | 27 Oct 2025 | 1 |
This describes our collected data; it is not a security assessment.
Observed since 20 Oct, 19:57 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package:f5c115d2ca6d16d5596786c0e0e4844aeea4bb73fd8376c21506321b05b9a080