{"_id":"@1shotapi/x402-facilitator","_rev":"3-c9f51b89676438a061f0da974bb49e7f","name":"@1shotapi/x402-facilitator","dist-tags":{"latest":"2.0.0"},"versions":{"1.0.0":{"name":"@1shotapi/x402-facilitator","version":"1.0.0","keywords":["1shotapi","x402","facilitator"],"author":{"name":"1Shot API"},"license":"Apache-2.0","_id":"@1shotapi/x402-facilitator@1.0.0","maintainers":[{"name":"csibbach","email":"charlottewisteria@gmail.com"},{"name":"todd_uxly","email":"todd@uxly.software"}],"homepage":"https://github.com/coinbase/x402#readme","bugs":{"url":"https://github.com/coinbase/x402/issues"},"dist":{"shasum":"b0e47c3552e1a8da0fc7e92cbb13ce7d507d264e","tarball":"https://registry.npmjs.org/@1shotapi/x402-facilitator/-/x402-facilitator-1.0.0.tgz","fileCount":8,"integrity":"sha512-wOtEbATcodu6EpEKW85PGD98W+NOElWQ4uZXq71eyKAg+0lQsO+HZ0eJX0UNunJ6FyfWj0aU8YLelahx81XsnA==","signatures":[{"sig":"MEUCIQDJhPDWJSFUrweh//V9F0Y8xZvMZeJLJjwPFI9Y20g1pQIgZAKfIMBSACCoFKvpEF4piqYWwyh7VBI9T/0nhvmwm+Q=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":17880},"main":"./dist/cjs/index.js","_from":"file:1shotapi-x402-facilitator-1.0.0.tgz","types":"./dist/index.d.ts","module":"./dist/esm/index.js","exports":{".":{"import":{"types":"./dist/esm/index.d.mts","default":"./dist/esm/index.mjs"},"require":{"types":"./dist/cjs/index.d.ts","default":"./dist/cjs/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}\""},"_npmUser":{"name":"csibbach","email":"charlottewisteria@gmail.com"},"_resolved":"C:\\Users\\charl\\AppData\\Local\\Temp\\cc293febbfc36dd40a7e5036a9f52e7d\\1shotapi-x402-facilitator-1.0.0.tgz","_integrity":"sha512-wOtEbATcodu6EpEKW85PGD98W+NOElWQ4uZXq71eyKAg+0lQsO+HZ0eJX0UNunJ6FyfWj0aU8YLelahx81XsnA==","repository":{"url":"git+https://github.com/coinbase/x402.git","type":"git"},"_npmVersion":"11.5.1","description":"x402 Payment Protocol facilitator package for 1Shot API","directories":{},"_nodeVersion":"20.19.1","dependencies":{"zod":"^3.24.2","x402":"^0.6.5"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.19.2","tsup":"^8.4.0","vite":"^6.2.6","eslint":"^9.24.0","vitest":"^3.0.5","prettier":"3.5.2","@eslint/js":"^9.24.0","typescript":"^5.7.3","@types/node":"^22.13.4","eslint-plugin-jsdoc":"^50.6.9","vite-tsconfig-paths":"^5.1.4","eslint-plugin-import":"^2.31.0","eslint-plugin-prettier":"^5.2.6","@typescript-eslint/parser":"^8.29.1","@typescript-eslint/eslint-plugin":"^8.29.1"},"_npmOperationalInternal":{"tmp":"tmp/x402-facilitator_1.0.0_1759266570413_0.7700910998560078","host":"s3://npm-registry-packages-npm-production"}},"2.0.0":{"name":"@1shotapi/x402-facilitator","version":"2.0.0","main":"./dist/cjs/index.js","module":"./dist/esm/index.js","types":"./dist/index.d.ts","keywords":["1shotapi","x402","facilitator"],"license":"Apache-2.0","author":{"name":"1Shot API"},"repository":{"type":"git","url":"git+https://github.com/1Shot-API/x402.git"},"description":"x402 Payment Protocol facilitator package for 1Shot API","devDependencies":{"@eslint/js":"^9.24.0","@types/node":"^22.13.4","@typescript-eslint/eslint-plugin":"^8.29.1","@typescript-eslint/parser":"^8.29.1","eslint":"^9.24.0","eslint-plugin-import":"^2.31.0","eslint-plugin-jsdoc":"^50.6.9","eslint-plugin-prettier":"^5.2.6","prettier":"3.5.2","tsup":"^8.4.0","tsx":"^4.19.2","typescript":"^5.7.3","vite":"^6.2.6","vite-tsconfig-paths":"^5.1.4","vitest":"^3.0.5"},"dependencies":{"zod":"^3.24.2","@x402/core":"2.6.0","x402":"^1.2.0"},"exports":{".":{"import":{"types":"./dist/esm/index.d.mts","default":"./dist/esm/index.mjs"},"require":{"types":"./dist/cjs/index.d.ts","default":"./dist/cjs/index.js"}}},"publishConfig":{"access":"public"},"scripts":{"start":"tsx --env-file=.env index.ts","build":"tsup","watch":"tsc --watch","format":"prettier -c .prettierrc --write \"**/*.{ts,js,cjs,json,md}\"","format:check":"prettier -c .prettierrc --check \"**/*.{ts,js,cjs,json,md}\"","lint":"eslint . --ext .ts --fix","lint:check":"eslint . --ext .ts","test":"vitest run","test:watch":"vitest"},"_id":"@1shotapi/x402-facilitator@2.0.0","bugs":{"url":"https://github.com/1Shot-API/x402/issues"},"homepage":"https://github.com/1Shot-API/x402#readme","_integrity":"sha512-7xnUrl+UXLjPrVYxlgGGKc7zHWFeoG3lujoHrf78en7dE3NR/jiqgpUKSOcg9bHdyOo816ZRWzUheyYi4P46+Q==","_resolved":"/tmp/a7e445171362578af8e5e30a6b4cc7d6/1shotapi-x402-facilitator-2.0.0.tgz","_from":"file:1shotapi-x402-facilitator-2.0.0.tgz","_nodeVersion":"22.8.0","_npmVersion":"10.8.2","dist":{"integrity":"sha512-7xnUrl+UXLjPrVYxlgGGKc7zHWFeoG3lujoHrf78en7dE3NR/jiqgpUKSOcg9bHdyOo816ZRWzUheyYi4P46+Q==","shasum":"7e1b352f160e100244b43a9a2d6b616bb2b291c0","tarball":"https://registry.npmjs.org/@1shotapi/x402-facilitator/-/x402-facilitator-2.0.0.tgz","fileCount":8,"unpackedSize":29472,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIHV6rZWUryRe0baO1BXo2tYhqf9KnfNDyZt+n18fVXmYAiBcUFjy4cXcGRll4z7DonoKP1eRgiHx3z3RyzPjjnf9LA=="}]},"_npmUser":{"name":"tthebc01","email":"tac688@alumni.stanford.edu"},"directories":{},"maintainers":[{"name":"tthebc01","email":"tac688@alumni.stanford.edu"},{"name":"csibbach","email":"charlottewisteria@gmail.com"},{"name":"todd_uxly","email":"todd@uxly.software"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/x402-facilitator_2.0.0_1774046261179_0.7826241399547884"},"_hasShrinkwrap":false}},"time":{"created":"2025-09-30T21:09:30.296Z","modified":"2026-03-20T22:37:41.505Z","1.0.0":"2025-09-30T21:09:30.609Z","2.0.0":"2026-03-20T22:37:41.326Z"},"bugs":{"url":"https://github.com/1Shot-API/x402/issues"},"author":{"name":"1Shot API"},"license":"Apache-2.0","homepage":"https://github.com/1Shot-API/x402#readme","keywords":["1shotapi","x402","facilitator"],"repository":{"type":"git","url":"git+https://github.com/1Shot-API/x402.git"},"description":"x402 Payment Protocol facilitator package for 1Shot API","maintainers":[{"name":"tthebc01","email":"tac688@alumni.stanford.edu"},{"name":"csibbach","email":"charlottewisteria@gmail.com"},{"name":"todd_uxly","email":"todd@uxly.software"}],"readme":"# @1shotapi/x402-facilitator\n\nThe official [1Shot API](https://1shotapi.com) facilitator package for the x402 Payment Protocol. This package enables you to integrate x402 payments into your server via 1Shot API's managed facilitator service, enabling seamless payment verification and settlement.\n\nCheck out the 1Shot API [x402 documentation](https://docs.1shotapi.com/x402/index.html) and install the 1Shot API [skill package](https://github.com/1Shot-API/skills) for building with agentic coding tools. \n\n## Setting up your 1Shot API Account\n\n1. Create a free account at https://1shotapi.com\n2. Create a server wallet on the network you want to process payments on & deposit gas tokens.\n3. Import the `transferWithAuthorization` method for your target payment token. \n\n## Installation\n\n```bash\nnpm install @1shotapi/x402-facilitator\n```\n\nFor an Express server using the x402 resource server stack, you will also need `@x402/express`, `@x402/core`, and `@x402/evm` (or your chain’s server package) as shown in the example below.\n\n## Environment Variables\n\nThis package uses API keys from the [1Shot API](https://1shotapi.com) service for authenticated operations:\n\n- `ONESHOT_API_KEY`: Your 1Shot API key\n- `ONESHOT_API_SECRET`: Your 1Shot API secret\n\nYou can set these in the environment, or pass `apiKey` / `apiSecret` into `create1ShotAPIFacilitatorClient` (or `createFacilitatorConfig` / `create1ShotAPIAuthHeaders`) explicitly.\n\n### Endpoint Authentication Requirements\n\n| Endpoint    | Authentication Required | Purpose                                             |\n| ----------- | ----------------------- | --------------------------------------------------- |\n| `list`      | ❌ No                   | Discover available bazaar items and payment options |\n| `verify`    | ✅ Yes                  | Verify payment transactions                         |\n| `settle`    | ✅ Yes                  | Settle completed payments                           |\n| `supported` | ✅ Yes                  | List active chains in your 1Shot API organization   |\n\n**Note:** an API key/secret is required to use `supported`, `verify` and `settle` endpoints. 1Shot API does not currently support `list`.\n\n## Quick Start\n\nUse **`create1ShotAPIFacilitatorClient`** when wiring the facilitator into **`x402ResourceServer`** (the pattern used by the official Express integration):\n\n```typescript\nimport express from \"express\";\nimport {\n  paymentMiddlewareFromHTTPServer,\n  x402HTTPResourceServer,\n  x402ResourceServer,\n} from \"@x402/express\";\nimport type { RoutesConfig } from \"@x402/core/server\";\nimport { ExactEvmScheme } from \"@x402/evm/exact/server\";\nimport { create1ShotAPIFacilitatorClient } from \"@1shotapi/x402-facilitator\";\n\nconst evmAddress = process.env.EVM_ADDRESS as `0x${string}`;\nconst facilitatorClient = create1ShotAPIFacilitatorClient({\n  apiKey: process.env.ONESHOT_API_KEY,\n  apiSecret: process.env.ONESHOT_API_SECRET,\n});\n\nconst routes = {\n  \"GET /weather\": {\n    accepts: {\n      scheme: \"exact\",\n      price: \"$0.01\",\n      network: \"eip155:8453\",\n      payTo: evmAddress,\n    },\n    description: \"Weather data\",\n    mimeType: \"application/json\",\n  },\n} satisfies RoutesConfig;\n\nconst resourceServer = new x402ResourceServer(facilitatorClient)\n  .register(\"eip155:8453\", new ExactEvmScheme());\n\nconst httpServer = new x402HTTPResourceServer(resourceServer, routes);\n\nconst app = express();\napp.use(paymentMiddlewareFromHTTPServer(httpServer));\n\napp.get(\"/weather\", (_, res) => {\n  res.send({ report: { weather: \"sunny\", temperature: 70 } });\n});\n\napp.listen(4021);\n```\n\nA full runnable server (CORS, optional logging hooks, and `onProtectedRequest` debugging) lives in **`examples/typescript/servers/1shotapi-example/index.ts`** in this repository.\n\n### Alternative: facilitator config only\n\nIf your stack expects a **`FacilitatorConfig`** (URL + auth) instead of a **`FacilitatorClient`**, use the default export or **`createFacilitatorConfig`**:\n\n```typescript\nimport { facilitator, createFacilitatorConfig } from \"@1shotapi/x402-facilitator\";\n\n// Reads ONESHOT_API_KEY / ONESHOT_API_SECRET from the environment\nconst fromEnv = createFacilitatorConfig();\n\n// Or pass credentials directly\nconst fromSecrets = createFacilitatorConfig(\"your-api-key\", \"your-api-secret\");\n```\n\nThe pre-built **`facilitator`** constant is `createFacilitatorConfig()` with no arguments (same env resolution as above).\n","readmeFilename":"README.md"}