{"_id":"402.js","name":"402.js","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"402.js","version":"1.0.0","description":"A lightweight wrapper around axios that adds 402 Payment Required retry hooks and pluggable paywall handlers.","type":"module","main":"src/index.js","exports":{".":"./src/index.js"},"keywords":["402","payments","axios","api","micropayments","paywall"],"author":{"name":"Your Name","email":"you@example.com"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/yourusername/402.js.git"},"bugs":{"url":"https://github.com/yourusername/402.js/issues"},"homepage":"https://github.com/yourusername/402.js#readme","scripts":{"prepare":"echo 'preparing 402.js'","build":"node -e \"console.log('no build step')\"","test":"node ./src/index.js --self-test"},"dependencies":{"axios":"^1.7.7"},"_id":"402.js@1.0.0","_nodeVersion":"22.21.0","_npmVersion":"10.9.4","dist":{"integrity":"sha512-Y/ZJYOo9oyAZ4o1Nm8fMonM40XmHSVXn3pckCHxk1H86dMfzPCgKW+eLDhwMAk9VoxSvnLYB8be1L2uB+J8LKg==","shasum":"815335192bb6dafc779e9047e4c7eb9d993b6b8f","tarball":"https://registry.npmjs.org/402.js/-/402.js-1.0.0.tgz","fileCount":5,"unpackedSize":5258,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCNZcNi4TlBl38961SLjfB5Mun6CkCb1ZlGwGWwetzs7QIhAK9/aZb+d79EPjenGvLKshxkph+IkYZ5Qmhq6CPbSbHy"}]},"_npmUser":{"name":"402.js","email":"lynk83809@gmail.com"},"directories":{},"maintainers":[{"name":"402.js","email":"lynk83809@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/402.js_1.0.0_1761572062450_0.0236356068901451"},"_hasShrinkwrap":false}},"time":{"created":"2025-10-27T13:34:22.375Z","1.0.0":"2025-10-27T13:34:22.673Z","modified":"2025-10-27T13:34:22.956Z"},"maintainers":[{"name":"402.js","email":"lynk83809@gmail.com"}],"description":"A lightweight wrapper around axios that adds 402 Payment Required retry hooks and pluggable paywall handlers.","homepage":"https://github.com/yourusername/402.js#readme","keywords":["402","payments","axios","api","micropayments","paywall"],"repository":{"type":"git","url":"git+https://github.com/yourusername/402.js.git"},"author":{"name":"Your Name","email":"you@example.com"},"bugs":{"url":"https://github.com/yourusername/402.js/issues"},"license":"MIT","readme":"# 402.js\n\nA tiny axios wrapper that adds **HTTP 402 (Payment Required)** handling via a pluggable callback.\n\n## Install\n\n```bash\nnpm install 402.js\n# or\npnpm add 402.js\n```\n\n> If you're publishing this yourself, run `npm publish` inside this folder.\n\n## Usage\n\n```js\nimport { createClient } from \"402.js\";\n\nconst client = createClient({\n  maxRetries: 1,\n  onPaymentRequired: async ({ config, error, attempt }) => {\n    // TODO: trigger your payment flow here (Stripe, Solana, Pump.fun, etc.)\n    // Return true to retry the request after payment succeeds.\n    console.log(\"402 received; attempt:\", attempt);\n    return false;\n  }\n});\n\nconst res = await client.get(\"https://api.example.com/protected\");\nconsole.log(res.data);\n```\n\n## API\n\n### `createClient(options)`\n\n- `maxRetries` (default `1`): number of times to retry after your payment callback returns `true`.\n- `onPaymentRequired(ctx)` => `Promise<boolean>`: called when a response is `402`. Return `true` to retry once payment succeeds.\n- `axiosConfig`: passed to `axios.create()`.\n\nReturns an object with `{ axios, get, post, put, patch, delete, request }`.\n\n## License\n\nMIT","readmeFilename":"README.md","_rev":"1-450e74eefcc9cc47bf089426eb4c9b27"}