{"_id":"@apiosk/checkout-core","_rev":"2-a79ff3eb8517c88f0c5a47e11bf8e523","name":"@apiosk/checkout-core","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@apiosk/checkout-core","version":"0.1.0","keywords":["apiosk","checkout","payments","x402","credits"],"author":{"name":"Apiosk"},"license":"MIT","_id":"@apiosk/checkout-core@0.1.0","maintainers":[{"name":"olivierbrinkman","email":"ollybrinkman@gmail.com"}],"homepage":"https://docs.apiosk.com","dist":{"shasum":"08d57f8bc69ccb05fd68b51bada9bef6651e280a","tarball":"https://registry.npmjs.org/@apiosk/checkout-core/-/checkout-core-0.1.0.tgz","fileCount":4,"integrity":"sha512-16XTenIgPTvYpRA0m2MAyulDBU8JtylaJeSHMOvyIAG23vc5wvKQJ/7cQR9IZ1/H4MmzypWZu5Ve8gZfnArL5Q==","signatures":[{"sig":"MEYCIQCzZr2ZhfYnH6WoxfNzljMip2edSx5V2YP4FhxBF9ePSQIhAIaSJcNhua2F92YPLCxsBpUXf1ZAQljLvreNMKcof9Ua","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":18392},"main":"./index.mjs","type":"module","types":"./index.d.ts","exports":{".":{"types":"./index.d.ts","default":"./index.mjs"}},"gitHead":"4ffab03f444d9b52946f9889916deb29488964da","scripts":{"check":"node --check index.mjs"},"_npmUser":{"name":"olivierbrinkman","email":"ollybrinkman@gmail.com"},"_npmVersion":"11.4.2","description":"Shared checkout schema, rails, intent payload helpers, and webhook utilities for Apiosk checkout packages","directories":{},"_nodeVersion":"24.3.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/checkout-core_0.1.0_1775835586838_0.10476900088663466","host":"s3://npm-registry-packages-npm-production"}}},"time":{"created":"2026-04-10T15:39:46.684Z","modified":"2026-08-16T19:44:07.950Z","0.1.0":"2026-04-10T15:39:46.968Z"},"author":{"name":"Apiosk"},"license":"MIT","homepage":"https://docs.apiosk.com","keywords":["apiosk","checkout","payments","x402","credits"],"description":"Shared checkout schema, rails, intent payload helpers, and webhook utilities for Apiosk checkout packages","maintainers":[{"email":"ollybrinkman@gmail.com","name":"olivierbrinkman"},{"email":"olivier@apiosk.com","name":"apiosk-packages"}],"readme":"# `@apiosk/checkout-core`\n\nShared checkout contract for all Apiosk checkout surfaces.\n\nThis package owns the schema and helper layer that the other checkout modules\nshould agree on:\n\n- rail metadata\n- normalized checkout config\n- checkout intent payload shape\n- checkout status path helpers\n- webhook event names\n- webhook signature helpers\n\n## Install\n\nAfter publish:\n\n```bash\nnpm install @apiosk/checkout-core\n```\n\nBefore publish:\n\n```bash\nnpm install ./subs/checkout-core\n```\n\n## What belongs here\n\n`checkout-core` is not a UI package. It should stay framework-neutral and avoid\nReact, Vue, DOM, and CSS concerns.\n\nUse it when you need to:\n\n- build a merchant checkout intent payload\n- normalize rail configuration before rendering a button\n- keep webhook naming and signature handling consistent\n- share the same checkout schema between web, React, Vue, and server code\n\n## Quick start\n\n```js\nimport {\n  createCheckoutIntentPayload,\n  normalizeCheckoutConfig,\n  selectDefaultRail,\n} from \"@apiosk/checkout-core\";\n\nconst config = normalizeCheckoutConfig({\n  merchantName: \"Northstar Marketplace\",\n  productName: \"Automation bundle\",\n  amountLabel: \"24.95 EUR\",\n  orderReference: \"ord_2048\",\n  rails: [\n    { id: \"credits\", status: \"live\" },\n    { id: \"x402\", status: \"live\" },\n    { id: \"agent\", status: \"pilot\" },\n  ],\n  callbacks: {\n    successUrl: \"https://merchant.example/success\",\n    cancelUrl: \"https://merchant.example/cancel\",\n    webhookUrl: \"https://merchant.example/webhooks/apiosk\",\n    statusUrl: \"https://merchant.example/api/orders/ord_2048\",\n  },\n});\n\nconst payload = createCheckoutIntentPayload(config);\nconst defaultRail = selectDefaultRail(config.rails);\n```\n\n## Normalized config\n\nThe normalizer accepts both:\n\n- a flat button-friendly shape like `merchantName`, `productName`, `amountLabel`\n- a structured config with `merchant`, `order`, `appearance`, and `callbacks`\n\nThat lets internal dashboard code migrate incrementally while external SDKs use\nthe structured version from day one.\n\n## Intent contract\n\n`createCheckoutIntentPayload()` produces the payload shape that the future\ncheckout API should accept at:\n\n- `POST /v1/checkout/intents`\n- `GET /v1/checkout/intents/:id`\n\nThis package is where that contract should evolve first.\n\n## Webhook helpers\n\nUse `createWebhookSignature()` and `verifyWebhookSignature()` for server-side\nsignature handling:\n\n```js\nimport { verifyWebhookSignature } from \"@apiosk/checkout-core\";\n\nconst rawBody = '{\"event\":\"checkout.intent.paid\"}';\nconst signature = request.headers[\"x-apiosk-signature\"];\n\nconst isValid = await verifyWebhookSignature(\n  rawBody,\n  signature,\n  process.env.APIOSK_WEBHOOK_SECRET,\n);\n```\n\nPass the raw request body string whenever possible.\n","readmeFilename":"README.md"}