{"_id":"@armsves/x402","_rev":"3-b66c856bf7583477c4f9ce3d3a515da5","name":"@armsves/x402","dist-tags":{"latest":"0.1.2"},"versions":{"0.1.0":{"name":"@armsves/x402","version":"0.1.0","keywords":["x402","eurd","quantoz","algorand","algoeupay","payments"],"license":"MIT","_id":"@armsves/x402@0.1.0","maintainers":[{"name":"armsves","email":"armsves@gmail.com"}],"dist":{"shasum":"b6538af0cb3b7b94f120a44aa0627804e04d2db8","tarball":"https://registry.npmjs.org/@armsves/x402/-/x402-0.1.0.tgz","fileCount":37,"integrity":"sha512-R4L70vu3hSEizFUc28lTjUFYcVBFB+yxSuXJqLnZvNQj+t+LlVbwBQbMrJAlMMAdAkVtWqobF+rZMqSkEluRuw==","signatures":[{"sig":"MEUCICKRirj2zOX3UVVW8BFEgtNmZC58IKDlr0RzXxj3ERsWAiEAus09Klg/p4p8LgiJzQujXFFCq54/cIxOtqoAhDdmqU4=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":53851},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=18"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"dev":"tsc --watch","build":"tsc"},"_npmUser":{"name":"armsves","email":"armsves@gmail.com"},"_npmVersion":"11.12.1","description":"x402 EURD payments on Algorand via Quantoz — buyer fetch wrapper, merchant challenges, QR payment requests","directories":{},"_nodeVersion":"24.15.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.4.5","@types/node":"^20.12.7"},"_npmOperationalInternal":{"tmp":"tmp/x402_0.1.0_1780799226899_0.7177066723634242","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@armsves/x402","version":"0.1.1","keywords":["x402","eurd","quantoz","algorand","algoeupay","payments"],"license":"MIT","_id":"@armsves/x402@0.1.1","maintainers":[{"name":"armsves","email":"armsves@gmail.com"}],"homepage":"https://github.com/armsves/AlgoEuPay/tree/main/sdk/typescript#readme","bugs":{"url":"https://github.com/armsves/AlgoEuPay/issues"},"dist":{"shasum":"d7f5b984cd9d08d0878e2d4245c592e21fb6d2d7","tarball":"https://registry.npmjs.org/@armsves/x402/-/x402-0.1.1.tgz","fileCount":41,"integrity":"sha512-GAvT6apslTdbvqitUQofDC2Vr+l4YRUpxDQc2w91jWl9rnzg/s+IKlHmnJ9VpcyPcfyKcQFrKIyFtfrZuM42Ig==","signatures":[{"sig":"MEQCIDKSau51NaJwCqRyQ3stYb2bJbyxZq8NHjLhZRzpakisAiBeUifxTmYzIkUrJlKpqNOJDw7MSjiD+IukMV48GuJfrg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":61220},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=18"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"fd743da47993fad8862b7d746bfd5307bda43150","scripts":{"dev":"tsc --watch","build":"tsc","prepublishOnly":"npm run build"},"_npmUser":{"name":"armsves","email":"armsves@gmail.com"},"repository":{"url":"git+https://github.com/armsves/AlgoEuPay.git","type":"git","directory":"sdk/typescript"},"_npmVersion":"11.12.1","description":"x402 EURD payments on Algorand via Quantoz — buyer fetch wrapper, merchant challenges, QR payment requests","directories":{},"_nodeVersion":"24.15.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.4.5","@types/node":"^20.12.7"},"_npmOperationalInternal":{"tmp":"tmp/x402_0.1.1_1780806695025_0.13280084090589117","host":"s3://npm-registry-packages-npm-production"}},"0.1.2":{"name":"@armsves/x402","version":"0.1.2","description":"x402 EURD payments on Algorand via Quantoz — buyer fetch wrapper, merchant challenges, QR payment requests","type":"module","main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"import":"./dist/index.js","types":"./dist/index.d.ts"}},"scripts":{"build":"tsc","dev":"tsc --watch","prepublishOnly":"npm run build"},"repository":{"type":"git","url":"git+https://github.com/armsves/AlgoEuPay.git","directory":"sdk/typescript"},"homepage":"https://github.com/armsves/AlgoEuPay/tree/main/sdk/typescript#readme","bugs":{"url":"https://github.com/armsves/AlgoEuPay/issues"},"keywords":["x402","eurd","quantoz","algorand","algoeupay","payments"],"license":"MIT","publishConfig":{"access":"public"},"devDependencies":{"@types/node":"^20.12.7","typescript":"^5.4.5"},"engines":{"node":">=18"},"gitHead":"1b0f13fbcc59fbde2a35fa1d67d90497b7457d7f","_id":"@armsves/x402@0.1.2","_nodeVersion":"24.15.0","_npmVersion":"11.12.1","dist":{"integrity":"sha512-B7jQBcX8tUvc2EiGNFo5qJpJh5sEEL8tVqhQTXetRkdfsMaWie5EaVBBUrZO2OW/mCGmmxw4vc4aihDEebFiNw==","shasum":"f24c339f44639cac9c3ac9fe92dc81006ee7ff71","tarball":"https://registry.npmjs.org/@armsves/x402/-/x402-0.1.2.tgz","fileCount":41,"unpackedSize":61676,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCudUtxLH8BcBIgV+fW8sLQIv/iW+iQ++qx6WV0xJX2UgIgbIK18RFUUKqVjB6kPHTnImuBrt4prdvcgdprOkWaELk="}]},"_npmUser":{"name":"armsves","email":"armsves@gmail.com"},"directories":{},"maintainers":[{"name":"armsves","email":"armsves@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/x402_0.1.2_1780806854167_0.6232123771367735"},"_hasShrinkwrap":false}},"time":{"created":"2026-06-07T02:27:06.759Z","modified":"2026-06-07T04:34:14.417Z","0.1.0":"2026-06-07T02:27:07.060Z","0.1.1":"2026-06-07T04:31:35.173Z","0.1.2":"2026-06-07T04:34:14.311Z"},"bugs":{"url":"https://github.com/armsves/AlgoEuPay/issues"},"license":"MIT","homepage":"https://github.com/armsves/AlgoEuPay/tree/main/sdk/typescript#readme","keywords":["x402","eurd","quantoz","algorand","algoeupay","payments"],"repository":{"type":"git","url":"git+https://github.com/armsves/AlgoEuPay.git","directory":"sdk/typescript"},"description":"x402 EURD payments on Algorand via Quantoz — buyer fetch wrapper, merchant challenges, QR payment requests","maintainers":[{"name":"armsves","email":"armsves@gmail.com"}],"readme":"# @armsves/x402\n\nTypeScript SDK for **x402 EURD payments on Algorand** via [Quantoz Pay](https://quantoz.com), with optional **AlgoEuPay backend guardrails** for wallet-managed spending.\n\n## Install\n\n```bash\nnpm install @armsves/x402\n```\n\n## Quick start — guarded payments (recommended)\n\nUse the AlgoEuPay backend so the Quantoz API key stays on the server and spend limits apply:\n\n```typescript\nimport { withGuardedPayment } from \"@armsves/x402\";\n\nconst fetch = withGuardedPayment(globalThis.fetch, {\n  backendUrl: \"http://localhost:8080\",\n  buyerAccount: \"YOUR_SEPA_ENABLED_QUANTOZ_ACCOUNT\",\n});\n\n// Automatically handles HTTP 402 → pay → retry with X-PAYMENT\nconst res = await fetch(\"http://localhost:8080/api/v1/x402/scenarios/online-product\");\nconst order = await res.json();\n```\n\n## Direct Quantoz API (no guardrails)\n\n```typescript\nimport { withEurPayment } from \"@armsves/x402\";\n\nconst fetch = withEurPayment(globalThis.fetch, {\n  apiKey: process.env.QUANTOZ_API_KEY!,\n  fromAccount: \"YOUR_SEPA_ENABLED_QUANTOZ_ACCOUNT\",\n});\n\nconst res = await fetch(\"https://your-api.example/forecast\");\n```\n\n## Merchant — create QR payment requests\n\n```typescript\nimport { createPaymentRequest, buildX402Challenge, buildEuroAcceptFromPaymentRequest } from \"@armsves/x402\";\n\nconst qr = await createPaymentRequest({\n  apiKey: process.env.QUANTOZ_API_KEY!,\n  amountEur: 0.20,\n  message: \"Coffee\",\n});\n\nconst challenge = buildX402Challenge({\n  amountEur: 0.20,\n  resource: \"https://merchant.example/checkout\",\n  euroAccept: buildEuroAcceptFromPaymentRequest(qr),\n});\n```\n\n## Verify payments (merchant server)\n\n```typescript\nimport { verifyPayment, createX402Middleware } from \"@armsves/x402\";\n\nconst ok = await verifyPayment({\n  apiKey: process.env.QUANTOZ_API_KEY!,\n  xPayment: request.headers.get(\"X-PAYMENT\")!,\n  expectedAmountEur: 0.15,\n});\n\n// Express-style helper\napp.get(\"/api/premium\", createX402Middleware({ amountEur: 0.15, apiKey: \"...\" }));\n```\n\n## API reference\n\n### Buyer\n\n| Export | Description |\n|--------|-------------|\n| `withEurPayment(fetch, options)` | Wrap `fetch` — auto-pay x402 402 challenges via Quantoz |\n| `withGuardedPayment(fetch, options)` | Wrap `fetch` — pay via AlgoEuPay backend + guardrails |\n| `payViaBackend(url, { buyerAccount, challenge, scenario })` | One-shot backend payment |\n| `fetchGuardrailStatus(url, buyerAccount)` | Read spend limits |\n| `checkGuardrails(url, buyerAccount, amountEur)` | Pre-flight limit check |\n\n### Merchant\n\n| Export | Description |\n|--------|-------------|\n| `buildX402Challenge(options)` | Build HTTP 402 JSON body |\n| `buildAlgorandChallenge(options)` | Algorand EURD accept entry |\n| `createPaymentRequest(options)` | Quantoz QR / payment request |\n| `verifyPayment(options)` | Validate `X-PAYMENT` header |\n| `createX402Middleware(options)` | Protect routes with x402 |\n\n### Low-level\n\n| Export | Description |\n|--------|-------------|\n| `payPaymentRequest`, `payAlgorandBridge`, `payX402Challenge` | Direct Quantoz payment calls |\n| `buildProof`, `buildBridgeProof`, `parseProof` | X-PAYMENT proof encoding |\n| `ALGOEUPAY_MERCHANT_WALLET`, `EURD_ASSET_ID`, … | Constants |\n\n## Demo scenarios (AlgoEuPay backend)\n\n| Scenario | Price | Endpoint |\n|----------|-------|----------|\n| Online product | €0.15 | `GET /api/v1/x402/scenarios/online-product` |\n| QR payment | €0.20 | `POST /api/v1/x402/scenarios/qr-payment/create` |\n| Hackathon report | €0.10 | `GET /api/v1/x402/scenarios/hackathon-report` |\n\nRun the backend, then:\n\n```bash\nBACKEND_URL=http://localhost:8080 node examples/scenarios.mjs\n```\n\n## Links\n\n- [AlgoEuPay repo](https://github.com/armsves/AlgoEuPay)\n- [x402 protocol](https://www.x402.org/)\n\n## License\n\nMIT\n","readmeFilename":"README.md"}