{"_id":"@ai2web/ap2-adapter","_rev":"2-6891ee09262dc014c3ee7efce95baedb","name":"@ai2web/ap2-adapter","dist-tags":{"latest":"0.4.3"},"versions":{"0.4.2":{"name":"@ai2web/ap2-adapter","version":"0.4.2","keywords":["ai2web","ap2","agent-payments","agentic-commerce","mandate","checkout","ai-agents","payments"],"license":"MIT","_id":"@ai2web/ap2-adapter@0.4.2","maintainers":[{"name":"rolandfarkas","email":"hello@rolandfarkas.com"}],"homepage":"https://ai2web.dev","bugs":{"url":"https://github.com/ai2web-foundation/ai2web-js/issues"},"dist":{"shasum":"b37e4c881e33e8b6a7a48ff787dd6ccdbe295f9e","tarball":"https://registry.npmjs.org/@ai2web/ap2-adapter/-/ap2-adapter-0.4.2.tgz","fileCount":6,"integrity":"sha512-e2GKGJah5MPNczd8OVWYJHEJwMo72ZRygTdgJRlpHdImXo7ms25s6RIHpe/Nnr30+0QW9meAcjgchR4Q7DucBQ==","signatures":[{"sig":"MEUCIQDNEEGe1YQ78Imf4iuUfT0Vc7U2us9EUpXAFZ2+KSwz9QIgb5RyTCSSxxCVIyWQW59MqlA+H0RQH5odZRuzPQV9kRo=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@ai2web%2fap2-adapter@0.4.2","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":11854},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","gitHead":"4c29f3cb1e3535ecb51eb26692560830374fd730","scripts":{"build":"tsc --build"},"_npmUser":{"name":"rolandfarkas","email":"hello@rolandfarkas.com"},"repository":{"url":"git+https://github.com/ai2web-foundation/ai2web-js.git","type":"git","directory":"packages/ap2-adapter"},"_npmVersion":"10.9.8","description":"Drive an AI2Web site's advertised AP2 (Agent Payments Protocol) merchant transport with approval-gated payment.","directories":{},"_nodeVersion":"22.23.1","dependencies":{"@ai2web/core":"0.4.2"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/ap2-adapter_0.4.2_1784675994929_0.8573430682108762","host":"s3://npm-registry-packages-npm-production"}},"0.4.3":{"name":"@ai2web/ap2-adapter","version":"0.4.3","keywords":["ai2web","ap2","agent-payments","agentic-commerce","mandate","checkout","ai-agents","payments"],"description":"Drive an AI2Web site's advertised AP2 (Agent Payments Protocol) merchant transport with approval-gated payment.","license":"MIT","repository":{"type":"git","url":"git+https://github.com/ai2web-foundation/ai2web-js.git","directory":"packages/ap2-adapter"},"homepage":"https://ai2web.dev","bugs":{"url":"https://github.com/ai2web-foundation/ai2web-js/issues"},"type":"module","main":"./dist/index.js","types":"./dist/index.d.ts","publishConfig":{"access":"public"},"dependencies":{"@ai2web/core":"0.4.3"},"scripts":{"build":"tsc --build"},"_id":"@ai2web/ap2-adapter@0.4.3","gitHead":"da42ca8a8b084d617748270b2c755618428c91fb","_nodeVersion":"22.23.1","_npmVersion":"10.9.8","dist":{"integrity":"sha512-IRWDuFIu1EnSCpAaAQsCOTfq9fU4MwSuBqVMDmWOTA8b57jMtebUiLa9IIavId3Re1kuTPXSipnZEcsqid5kHQ==","shasum":"920cf3759e5378847316084c22d9e5f2b3faabe6","tarball":"https://registry.npmjs.org/@ai2web/ap2-adapter/-/ap2-adapter-0.4.3.tgz","fileCount":6,"unpackedSize":11854,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@ai2web%2fap2-adapter@0.4.3","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCICToUlW9oRSp1C2w0vYDbkn/U5P0CnR2ntHY2wjAtH7FAiEA1iEek+mhCB2OEPQ+AgvvVF8aP3g+QtMZUrqeCQhLaXQ="}]},"_npmUser":{"name":"rolandfarkas","email":"hello@rolandfarkas.com"},"directories":{},"maintainers":[{"name":"rolandfarkas","email":"hello@rolandfarkas.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/ap2-adapter_0.4.3_1784847130213_0.6316069486471232"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-21T23:19:54.768Z","modified":"2026-07-23T22:52:10.677Z","0.4.2":"2026-07-21T23:19:55.056Z","0.4.3":"2026-07-23T22:52:10.343Z"},"bugs":{"url":"https://github.com/ai2web-foundation/ai2web-js/issues"},"license":"MIT","homepage":"https://ai2web.dev","keywords":["ai2web","ap2","agent-payments","agentic-commerce","mandate","checkout","ai-agents","payments"],"repository":{"type":"git","url":"git+https://github.com/ai2web-foundation/ai2web-js.git","directory":"packages/ap2-adapter"},"description":"Drive an AI2Web site's advertised AP2 (Agent Payments Protocol) merchant transport with approval-gated payment.","maintainers":[{"name":"rolandfarkas","email":"hello@rolandfarkas.com"}],"readme":"# @ai2web/ap2-adapter\n\nDrive an [AI2Web](https://ai2web.dev) site's advertised **AP2** ([Agent Payments Protocol](https://ap2-protocol.org/), Google) merchant transport. AP2 is mandate-based: the merchant signs a **Cart Mandate** guaranteeing the price for a buyer agent's **Intent Mandate**, then settles a user-signed **Payment Mandate**. This adapter presents the merchant vocabulary (fetch the agent card, fetch the JWKS, create a cart, settle payment) and routes it through the shared guarded executor in `@ai2web/core`, so the payment step (`settle_payment`) is high-risk and **always previews for approval before any charge** (RFC-0006 section 3).\n\nAI2Web does not define payment; it advertises which payment transport a site supports and lets the agent use it.\n\n## Install\n\n```bash\nnpm install @ai2web/ap2-adapter @ai2web/core\n```\n\n## Use\n\n```js\nimport { manifestToAp2, buildIntentMandate, runAp2Operation } from \"@ai2web/ap2-adapter\";\nimport { discover } from \"@ai2web/core\";\n\nconst { manifest } = await discover(\"https://some-ai2web-store.com\");\n\n// Present the AP2 operations (only if the site advertises transports.ap2)\nconst adapter = manifestToAp2(manifest);\n\n// Ask the merchant to price and sign a cart for an intent\nconst intent = buildIntentMandate({ description: \"a red basketball shoe\", skus: [\"SHOE-RED-42\"] });\nconst cartMandate = await runAp2Operation(manifest, \"create_cart\", intent);\n\n// After the buyer's credentials provider produces a Payment Mandate, settle it.\n// settle_payment is approval-gated: it returns a preview until the user approves.\nconst receipt = await runAp2Operation(manifest, \"settle_payment\", { payment_mandate: paymentMandate });\n```\n\nVerify the Cart Mandate's `merchant_authorization` JWT against the merchant's published keys with\n`runAp2Operation(manifest, \"get_jwks\", {})`.\n\nPart of [AI2Web](https://github.com/ai2web-foundation).\n","readmeFilename":"README.md"}