{"_id":"@bankofai/x402-legacy","_rev":"4-275b6c8312174a8d84c5a40157ca0d7a","name":"@bankofai/x402-legacy","dist-tags":{"beta":"1.1.0","latest":"1.1.0"},"versions":{"1.1.0":{"name":"@bankofai/x402-legacy","version":"1.1.0","keywords":[],"author":{"name":"bankofai"},"license":"Apache-2.0","_id":"@bankofai/x402-legacy@1.1.0","maintainers":[{"name":"virtual_parson","email":"parson.hu@tron.network"},{"name":"hades.ye","email":"hades.ye@tron.network"},{"name":"leo_tron","email":"leo.wu@tron.network"},{"name":"roger.gan","email":"roger.gan@tron.network"},{"name":"gummy789j","email":"gummy789j@gmail.com"},{"name":"wzc1206","email":"david.wang@tron.network"},{"name":"bobo123123hhh","email":"bobo.liu@tron.network"}],"homepage":"https://github.com/BofAI/x402#readme","bugs":{"url":"https://github.com/BofAI/x402/issues"},"dist":{"shasum":"31928123d85560aad95aeb9e88f4fe09605ee77f","tarball":"https://registry.npmjs.org/@bankofai/x402-legacy/-/x402-legacy-1.1.0.tgz","fileCount":92,"integrity":"sha512-R+1+V6ZWKEqonF2zHci/LolgR+LDxpOFGxMBeC+1+UQBgJgIPzQF3JjcgerpmSfnf8Gs7CMVzYTBVgh0MpqEaA==","signatures":[{"sig":"MEQCIAhPYvrxAjLZMUA2B1D3XZl4D6NHKScm3FO+uuWG8DpoAiAgkkvrD+HML4rkUqyfDQ9C2NuhWr+YGopvNRHw13KNQA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":16340475},"main":"./dist/cjs/index.js","_from":"file:bankofai-x402-legacy-1.1.0.tgz","types":"./dist/cjs/index.d.ts","module":"./dist/esm/index.js","exports":{"./types":{"import":{"types":"./dist/esm/types/index.d.mts","default":"./dist/esm/types/index.mjs"},"require":{"types":"./dist/cjs/types/index.d.ts","default":"./dist/cjs/types/index.js"}},"./client":{"import":{"types":"./dist/esm/client/index.d.mts","default":"./dist/esm/client/index.mjs"},"require":{"types":"./dist/cjs/client/index.d.ts","default":"./dist/cjs/client/index.js"}},"./shared":{"import":{"types":"./dist/esm/shared/index.d.mts","default":"./dist/esm/shared/index.mjs"},"require":{"types":"./dist/cjs/shared/index.d.ts","default":"./dist/cjs/shared/index.js"}},"./verify":{"import":{"types":"./dist/esm/verify/index.d.mts","default":"./dist/esm/verify/index.mjs"},"require":{"types":"./dist/cjs/verify/index.d.ts","default":"./dist/cjs/verify/index.js"}},"./paywall":{"import":{"types":"./dist/esm/paywall/index.d.mts","default":"./dist/esm/paywall/index.mjs"},"require":{"types":"./dist/cjs/paywall/index.d.ts","default":"./dist/cjs/paywall/index.js"}},"./schemes":{"import":{"types":"./dist/esm/schemes/index.d.mts","default":"./dist/esm/schemes/index.mjs"},"require":{"types":"./dist/cjs/schemes/index.d.ts","default":"./dist/cjs/schemes/index.js"}},"./shared/evm":{"import":{"types":"./dist/esm/shared/evm/index.d.mts","default":"./dist/esm/shared/evm/index.mjs"},"require":{"types":"./dist/cjs/shared/evm/index.d.ts","default":"./dist/cjs/shared/evm/index.js"}},"./facilitator":{"import":{"types":"./dist/esm/facilitator/index.d.mts","default":"./dist/esm/facilitator/index.mjs"},"require":{"types":"./dist/cjs/facilitator/index.d.ts","default":"./dist/cjs/facilitator/index.js"}}},"scripts":{"lint":"eslint . --ext .ts --fix","test":"vitest run","build":"tsup","start":"tsx --env-file=.env index.ts","watch":"tsc --watch","format":"prettier -c .prettierrc --write \"**/*.{ts,js,cjs,json,md}\"","lint:check":"eslint . --ext .ts","test:watch":"vitest","format:check":"prettier -c .prettierrc --check \"**/*.{ts,js,cjs,json,md}\"","build:paywall":"tsx src/paywall/build.ts"},"_npmUser":{"name":"bobo123123hhh","email":"bobo.liu@tron.network"},"_resolved":"/private/var/folders/0f/72lzrqsd7_dcw0_6_qdsyslc0000gn/T/5a3b30dda389817465c380e14a3b11d3/bankofai-x402-legacy-1.1.0.tgz","_integrity":"sha512-R+1+V6ZWKEqonF2zHci/LolgR+LDxpOFGxMBeC+1+UQBgJgIPzQF3JjcgerpmSfnf8Gs7CMVzYTBVgh0MpqEaA==","repository":{"url":"git+https://github.com/BofAI/x402.git","type":"git"},"_npmVersion":"11.8.0","description":"x402 Payment Protocol","directories":{},"_nodeVersion":"25.6.0","dependencies":{"zod":"^3.24.2","viem":"^2.21.26","wagmi":"^2.15.6","@scure/base":"^1.2.6","@solana/kit":"^5.0.0","@wallet-standard/app":"^1.1.0","@solana-program/token":"^0.9.0","@wallet-standard/base":"^1.1.0","@wallet-standard/features":"^1.1.0","@solana-program/token-2022":"^0.6.1","@solana-program/compute-budget":"^0.11.0","@solana/transaction-confirmation":"^5.0.0","@solana/wallet-standard-features":"^1.3.0"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.19.2","tsup":"^8.4.0","viem":"^2.21.26","vite":"^6.2.6","react":"19.2.1","buffer":"^6.0.3","eslint":"^9.24.0","vitest":"^3.0.5","esbuild":"^0.25.4","prettier":"3.5.2","react-dom":"19.2.1","@eslint/js":"^9.24.0","typescript":"^5.7.3","@types/node":"^22.13.4","@wagmi/core":"^2.17.1","@types/react":"^19","@types/react-dom":"^19","@wagmi/connectors":"^5.8.1","eslint-plugin-jsdoc":"^50.6.9","vite-tsconfig-paths":"^5.1.4","@coinbase/onchainkit":"^0.38.14","eslint-plugin-import":"^2.31.0","eslint-plugin-prettier":"^5.2.6","@typescript-eslint/parser":"^8.29.1","@craftamap/esbuild-plugin-html":"^0.9.0","@typescript-eslint/eslint-plugin":"^8.29.1"},"_npmOperationalInternal":{"tmp":"tmp/x402-legacy_1.1.0_1773471611305_0.5948823165033352","host":"s3://npm-registry-packages-npm-production"}}},"time":{"created":"2026-03-14T07:00:11.243Z","modified":"2026-09-16T08:35:59.197Z","1.1.0":"2026-03-14T07:00:11.654Z"},"bugs":{"url":"https://github.com/BofAI/x402/issues"},"author":{"name":"bankofai"},"license":"Apache-2.0","homepage":"https://github.com/BofAI/x402#readme","keywords":[],"repository":{"url":"git+https://github.com/BofAI/x402.git","type":"git"},"description":"x402 Payment Protocol","maintainers":[{"email":"parson.hu@tron.network","name":"virtual_parson"},{"email":"roger.gan@tron.network","name":"roger.gan"},{"email":"gummy789j@gmail.com","name":"gummy789j"},{"email":"david.wang@tron.network","name":"wzc1206"},{"email":"bobo.liu@tron.network","name":"bobo123123hhh"},{"email":"zerodevblock@gmail.com","name":"zerodev0"},{"email":"leon.zhang@tron.network","name":"leonatmoon"}],"readme":"# x402\n\nCore TypeScript implementation of the x402 Payment Protocol. This package provides the foundational types, schemas, and utilities that power all x402 integrations.\n\n## Installation\n\n```bash\nnpm install x402\n```\n\n## Overview\n\nThe x402 package provides the core building blocks for implementing the x402 Payment Protocol in TypeScript. It's designed to be used by:\n\n- Middleware implementations (Express, Hono, Next.js)\n- Client-side payment handlers (fetch wrapper)\n- Facilitator services\n- Custom integrations\n\n## Integration Packages\n\nThis core package is used by the following integration packages:\n\n- `x402-express`: Express.js middleware\n- `x402-hono`: Hono middleware\n- `x402-next`: Next.js middleware\n- `x402-fetch`: Fetch API wrapper\n- `x402-axios`: Axios interceptor\n\n## Manual Server Integration\n\nIf you're not using one of our server middleware packages, you can implement the x402 protocol manually. Here's what you'll need to handle:\n\n1. Return 402 error responses with the appropriate response body\n2. Use the facilitator to validate payments\n3. Use the facilitator to settle payments\n4. Return the appropriate response header to the caller\n\nFor a complete example implementation, see our [advanced server example](https://github.com/coinbase/x402/tree/main/examples/typescript/servers/advanced) which demonstrates both synchronous and asynchronous payment processing patterns.\n\n## Manual Client Integration\n\nIf you're not using our `x402-fetch` or `x402-axios` packages, you can manually integrate the x402 protocol in your client application. Here's how:\n\n1. Make a request to a x402-protected endpoint. The server will respond with a 402 status code and a JSON object containing:\n   - `x402Version`: The version of the x402 protocol being used\n   - `accepts`: An array of payment requirements you can fulfill\n\n2. Select the payment requirement you wish to fulfill from the `accepts` array\n\n3. Create the payment header using the selected payment requirement\n\n4. Retry your network call with:\n   - The payment header assigned to the `X-PAYMENT` field\n   - The `Access-Control-Expose-Headers` field set to `\"X-PAYMENT-RESPONSE\"` to receive the server's transaction response\n\nFor implementation examples, we recommend reviewing our official client packages:\n- [x402-fetch implementation](https://github.com/coinbase/x402/tree/main/typescript/packages/legacy/x402-fetch)\n- [x402-axios implementation](https://github.com/coinbase/x402/tree/main/typescript/packages/legacy/x402-axios)\n\n","readmeFilename":"README.md"}