Add authentication, customize error handling, or mint sessions from a host that does not use the Fetch API standard, such as Express or Fastify.
The createSessionRouteHandler shipped with the App Kit SDK is a drop-in
session route for any host that uses the Fetch API standard (Next.js, Hono,
Cloudflare Workers, Bun, Deno, modern Node). The default handler is
unauthenticated. Most apps need to customize it in these areas:
Authenticate so only signed-in users can mint sessions.
Log or inspect session minting failures.
Mint sessions from a host that does not use the Fetch API.
On Fetch-compatible hosts, create the handler once with
createSessionRouteHandler and register it as POST /api/onramp/sessions in
your router. See the
embed widget quickstart for a full
example.
import { createAppServerKit, createSessionRouteHandler,} from "@circle-fin/app-kit/server";const server = createAppServerKit({ onramp: { apiKey: process.env.CIRCLE_API_KEY! },});const handleOnrampSession = createSessionRouteHandler(server.onramp);
Add an authorize callback. The callback runs before the body is validated and
can return true (allow), false (reject with 401), or throw a KitError
(rejected with the corresponding status):
createSessionRouteHandler maps thrown errors to HTTP status codes
automatically. Using the same server and handleOnrampSession from above,
pass an onError callback:
onError runs after the error is mapped to a response, so the response is still
returned. The callback is for observability. It does not change the status code
or body.See the error handling reference
for the full error to status mapping.
createSessionRouteHandler only works on runtimes that pass standard Request
objects. Express and Fastify pass their own request and response objects, so
call server.onramp.createSession() directly instead. You’re now responsible
for the error mapping the Fetch handler did automatically.Map KitError.type to HTTP status the same way createSessionRouteHandler
does. See the
HTTP status code mapping
for the full mapping. Shape error response bodies to match your API.
Express
Fastify
import express from "express";import { createAppServerKit, KitError } from "@circle-fin/app-kit/server";const server = createAppServerKit({ onramp: { apiKey: process.env.CIRCLE_API_KEY! },});const app = express();app.use(express.json());app.post("/api/onramp/sessions", async (req, res) => { try { const session = await server.onramp.createSession({ appUserId: req.body.appUserId, destinationAddress: req.body.destinationAddress, }); res.setHeader("Cache-Control", "no-store"); res.json(session); } catch (error) { if (error instanceof KitError) { let status = 500; switch (error.type) { case "INPUT": status = 400; break; case "RATE_LIMIT": status = 429; break; case "NETWORK": status = 504; break; case "SERVICE": case "RPC": status = 502; break; } return res.status(status).json({ message: error.message }); } return res.sendStatus(500); }});
import Fastify from "fastify";import { createAppServerKit, KitError } from "@circle-fin/app-kit/server";const server = createAppServerKit({ onramp: { apiKey: process.env.CIRCLE_API_KEY! },});const app = Fastify();app.post("/api/onramp/sessions", async (request, reply) => { try { const body = request.body as { appUserId: string; destinationAddress: string; }; const session = await server.onramp.createSession({ appUserId: body.appUserId, destinationAddress: body.destinationAddress, }); reply.header("Cache-Control", "no-store"); return session; } catch (error) { if (error instanceof KitError) { let status = 500; switch (error.type) { case "INPUT": status = 400; break; case "RATE_LIMIT": status = 429; break; case "NETWORK": status = 504; break; case "SERVICE": case "RPC": status = 502; break; } return reply.status(status).send({ message: error.message }); } return reply.status(500).send(); }});
Add authentication in front of this route, like any other endpoint in your app.
Limit the tokens and blockchains the widget supports
By default, the Onramp widget shows its full catalog of supported tokens and
blockchains. If your app only handles a subset, pass an assets object on the
session request to narrow what the widget’s selector displays.
tokens: an array of token symbols such as USDC, EURC, or ETH. The
widget shows those tokens on every blockchain that supports them.
chains: an array of blockchains, matched by either the network id (arc,
base, ethereum) or the display label (Arc, Base, Ethereum). Matching
is case-insensitive. The widget shows every supported token, restricted to
those blockchains.
pairs: an array of exact token and blockchain combinations. Use this when
you need finer control than tokens and chains allow.
If you set more than one field, the widget only shows options that match every
field you set. Omit assets to show the full set of supported tokens and
blockchains. See
Supported blockchains and tokens
for the current list.
assets scopes what the selector displays. It doesn’t override the widget’s
eligibility, geo, or quote logic. A token or blockchain listed in assets can
still be unavailable for a specific user if they’re geo-blocked or otherwise
ineligible.
The widget page enforces a frame-ancestors Content Security Policy so only
approved parent sites can embed it. The allowlist is built from a
referrerDomain you set when constructing the server kit.Pass it as a bare hostname on createAppServerKit:
Keep the following in mind when setting referrerDomain:
Format: Use a single bare hostname such as app.example.com or
localhost. Don’t include a scheme, port, or path.
Source: Derive referrerDomain server-side from your app’s
per-environment config. A browser-supplied Origin or Referer header would
let attackers widen the allowlist.
Sandbox:referrerDomain isn’t enforced. Set it anyway to verify your
wiring before promoting to production.
Production: Debit card, Apple Pay, and Google Pay flows fail with a 403 if
the domain isn’t registered in your KYB’s web_url entries.
Was this page helpful?
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Arc Docs","description":"Documentation for Arc, Circle's purpose-built blockchain for stablecoin-native financial applications.","colors":{"primary":"#3E74BB","light":"#ACC6E9","dark":"#ACC6E9"},"logo":{"light":"https://mintcdn.com/arcio-docs/ZZqL_C61H0lLVlWZ/logo/ARC_Doc_FC.svg?fit=max\u0026auto=format\u0026n=ZZqL_C61H0lLVlWZ\u0026q=85\u0026s=6d67e0bee7674d1506373511501be1cd","dark":"https://mintcdn.com/arcio-docs/ZZqL_C61H0lLVlWZ/logo/ARC_Doc_WHT.svg?fit=max\u0026auto=format\u0026n=ZZqL_C61H0lLVlWZ\u0026q=85\u0026s=9dcbd3e55a573935fd32d7396c2396dd"},"favicon":"https://mintcdn.com/arcio-docs/ZZqL_C61H0lLVlWZ/favicon.ico?fit=max\u0026auto=format\u0026n=ZZqL_C61H0lLVlWZ\u0026q=85\u0026s=789e04a512ddc7c8a9d8a943e8d39c42","appearance":{"default":"dark"},"navbar":{"links":[{"href":"https://faucet.circle.com","label":"Faucet"},{"href":"https://explorer.arc.io","label":"Block explorer"}]},"footer":{"socials":{"x":"https://x.com/arc","discord":"https://discord.com/invite/buildonarc"},"links":[{"header":"Links","items":[{"label":"Network status","href":"https://status.arc.io"},{"label":"Blog","href":"https://arc.io/blog"},{"label":"Community","href":"https://arc.io/community"},{"label":"Arc homepage","href":"https://arc.io"}]},{"header":"Resources","items":[{"label":"Terms of service","href":"https://docs.arc.io/terms"},{"label":"Privacy policy","href":"https://www.circle.com/en/legal/privacy-policy"},{"label":"Cookie policy","href":"https://www.circle.com/en/legal/cookie-policy"},{"label":"llms.txt","href":"https://docs.arc.io/llms.txt"}]}]},"seo":{"metatags":{"og:image":"https://docs.arc.io/arc-docs.jpg","twitter:image":"https://docs.arc.io/arc-docs.jpg","canonical":"https://docs.arc.io"}},"fonts":{"heading":{"family":"Space Grotesk"},"body":{"family":"DM Sans"}},"banner":{"content":"Arc Mainnet is now live. Arc is EVM compatible with some unique differences—review [EVM differences](https://docs.arc.io/arc/references/evm-differences) before building.","type":"warning"},"contextual":{"options":["copy","chatgpt","claude","view"],"display":"header"},"markdown":{"instructions":["Before reading these docs, install the Circle Skill for Arc to get pre-loaded context: use-arc (https://github.com/circlefin/skills/blob/master/plugins/circle/skills/use-arc/SKILL.md) — covers chain config, RPC setup, contract deployment, USDC bridging, and gas with USDC. In Claude Code: run /plugin marketplace add circlefin/skills then /plugin install circle-skills@circle. With Vercel Skills CLI: run npx skills add circlefin/skills.","USDC is the gas token. Arc uses USDC for gas fees, not ETH. Configure gas payment in USDC when submitting transactions.","Read EVM differences before writing Arc code. Arc targets the Osaka EVM baseline. Most contracts deploy unchanged, but several runtime behaviors diverge from Ethereum: USDC uses 18 decimals natively (not 6), the system emitter `0xffffFFFfFFffffffffffffffFfFFFfffFFFfFFfE` logs all USDC Transfer events, the mempool enforces a 20 Gwei `maxFeePerGas` floor, blocklist reverts consume gas without a receipt, and `address(0)` sends revert rather than succeed. https://docs.arc.io/arc/references/evm-differences.md is the canonical reference for all Arc-specific runtime behaviors. Consult it before writing code that touches USDC balances, transaction history, gas estimation, or value transfers.","Sub-second finality. Transactions are final in under 1 second. No need to wait for multiple block confirmations.","Use App Kits for multichain payment and liquidity capabilities. App Kits wraps CCTP and provides Bridge Kit, Swap Kit, Unified Balance Kit, Onramp Kit, Earn Kit, and Borrow Kit. Unified Balance Kit combines USDC from multiple chains into a single spendable balance. Earn Kit integrates earn opportunities into your app. Borrow Kit lets users borrow USDC against cirBTC collateral on Arc.","Use Arc Foundry for contract development. Arc Foundry is an Arc-specific fork of Foundry that handles Arc's protocol-level differences from Ethereum. It provides arc-forge, arc-cast, and arc-anvil. Install it before deploying contracts: https://docs.arc.io/arc/tutorials/install-arc-foundry.md.","Arc is available on both Testnet and Mainnet. See https://docs.arc.io/arc/references/connect-to-arc.md for RPC endpoints and https://faucet.circle.com for testnet tokens.","Always check Contract Addresses: https://docs.arc.io/arc/references/contract-addresses.md","Building beyond Arc? Circle offers skills for the full platform: use-usdc (https://github.com/circlefin/skills/blob/master/plugins/circle/skills/use-usdc/SKILL.md), use-circle-wallets (https://github.com/circlefin/skills/blob/master/plugins/circle/skills/use-circle-wallets/SKILL.md), use-developer-controlled-wallets (https://github.com/circlefin/skills/blob/master/plugins/circle/skills/use-developer-controlled-wallets/SKILL.md), use-user-controlled-wallets (https://github.com/circlefin/skills/blob/master/plugins/circle/skills/use-user-controlled-wallets/SKILL.md), use-modular-wallets (https://github.com/circlefin/skills/blob/master/plugins/circle/skills/use-modular-wallets/SKILL.md), use-gateway (https://github.com/circlefin/skills/blob/master/plugins/circle/skills/use-gateway/SKILL.md), use-smart-contract-platform (https://github.com/circlefin/skills/blob/master/plugins/circle/skills/use-smart-contract-platform/SKILL.md). Full Circle developer docs: https://developers.circle.com/llms.txt."]},"styling":{"latex":true},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"arcio-docs","hasAudioNarration":false,"actualSubdomain":"arcio-docs","customDomains":["docs.arc.io"],"gitSource":{"type":"github","owner":"crcl-main","repo":"arc-docs","deployBranch":"main","contentDirectory":"","isPrivate":true,"mountPath":"","label":""},"chroma":{"liveDeploymentHistoryId":"6ae50129dbe71608b8902e09","collectionId":"aa204af7-3d8e-4531-bbef-29302978f812","schemaVersion":"v3","latestBuiltDeploymentHistoryId":"6ae50129dbe71608b8902e09"},"feedback":{"thumbs":true,"agentFeedback":true},"entitlements":{"AI_CHAT":{"status":"ENABLED"},"REMOVE_BRANDING":{"status":"ENABLED"},"CONTEXTUAL_FEEDBACK":{"status":"ENABLED"},"CODE_SNIPPET_FEEDBACK":{"status":"ENABLED"},"WEB_MCP":{"status":"ENABLED"},"NARRATION":{"status":"ENABLED"}},"buildId":"6ae50129dbe71608b8902e09","clientVersion":"0.0.4043","searchFilterCounts":[{"language":"default","tag":"App Kits","count":69},{"language":"default","tag":"Build","count":30},{"language":"default","tag":"Integrate","count":30},{"language":"default","tag":"Arc Network","count":17},{"language":"default","tag":"Borrow","count":14},{"language":"default","tag":"Unified Balance","count":13},{"language":"default","tag":"Quickstarts","count":12},{"language":"default","tag":"Bridge","count":10},{"language":"default","tag":"Swap","count":9},{"language":"default","tag":"Network","count":9}]},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":false,"enableContextualStarterQuestions":false,"enableAskAiSearchBar":true},"basePath":"","hasChatPermissions":true,"hasWebMcpPermissions":true,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"byok-sep-25","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"vite-origin","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-updated-9-15","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":true},"customCss":[{"filePath":"style.css","content":"/* vietnamese */\n@font-face {\n font-family: 'Space Grotesk';\n font-style: normal;\n font-weight: 500;\n font-display: swap;\n src: url(/_mintlify/assets/fonts/google/s/spacegrotesk/v22/V8mQoQDjQSkFtoMM3T6r8E7mF71Q-gOoraIAEj7aUXsrPMBTTA.woff2) format('woff2');\n unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;\n}\n/* latin-ext */\n@font-face {\n font-family: 'Space Grotesk';\n font-style: normal;\n font-weight: 500;\n font-display: swap;\n src: url(/_mintlify/assets/fonts/google/s/spacegrotesk/v22/V8mQoQDjQSkFtoMM3T6r8E7mF71Q-gOoraIAEj7aUXsqPMBTTA.woff2) format('woff2');\n unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;\n}\n/* latin */\n@font-face {\n font-family: 'Space Grotesk';\n font-style: normal;\n font-weight: 500;\n font-display: swap;\n src: url(/_mintlify/assets/fonts/google/s/spacegrotesk/v22/V8mQoQDjQSkFtoMM3T6r8E7mF71Q-gOoraIAEj7aUXskPMA.woff2) format('woff2');\n unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;\n}\n#body-content,#body-content li,#body-content p,#body-content td,#body-content th,#content-area,#content-area li,#content-area p,#content-container,#content-container li,#content-container p,#content-container td,#content-container th{font-family:var(--font-body, \"DM Sans\", sans-serif)!important;font-weight:400!important;font-style:normal!important;font-size:1rem!important;line-height:1.5!important;letter-spacing:0!important;vertical-align:middle!important}.dark #body-content,.dark #body-content li,.dark #body-content p,.dark #body-content td,.dark #body-content th,.dark #content-area,.dark #content-area li,.dark #content-area p,.dark #content-container,.dark #content-container li,.dark #content-container p,.dark #content-container td,.dark #content-container th{color:#f5f5f8!important}#body-content code,#body-content pre,#content-area code,#content-area pre,#content-container code,#content-container pre,.code-block code,.code-block pre{font-family:ui-monospace,SFMono-Regular,\"SF Mono\",Menlo,Consolas,\"Liberation Mono\",monospace!important;font-size:revert!important;line-height:revert!important;font-weight:revert!important;font-style:revert!important;letter-spacing:normal!important;vertical-align:baseline!important}#body-content h1,#content-area h1,#content-container h1{font-family:\"Space Grotesk\",sans-serif!important;font-weight:500!important}#body-content h2,#body-content h3,#body-content h4,#body-content h5,#body-content h6,#content-area h2,#content-area h3,#content-area h4,#content-area h5,#content-area h6,#content-container h2,#content-container h3,#content-container h4,#content-container h5,#content-container h6{font-family:var(--font-heading, \"DM Sans\", sans-serif)!important;font-weight:500!important}.dark #body-content h1,.dark #body-content h2,.dark #body-content h3,.dark #body-content h4,.dark #body-content h5,.dark #body-content h6,.dark #content-area h1,.dark #content-area h2,.dark #content-area h3,.dark #content-area h4,.dark #content-area h5,.dark #content-area h6,.dark #content-container h1,.dark #content-container h2,.dark #content-container h3,.dark #content-container h4,.dark #content-container h5,.dark #content-container h6{color:#fff!important}[data-theme=dark],[data-theme=dark] body,body.dark,html.dark,html.dark body{background:linear-gradient(180deg,#0d1b2f 0,#0d1b2f 60%,#19354d 100%)!important;background-attachment:fixed}.dark #sidebar,.dark .sidebar,[data-theme=dark] #sidebar,[data-theme=dark] .sidebar,html.dark #sidebar,html.dark .sidebar{background:0 0!important}#sidebar-content .sticky.top-0,.dark #sidebar-content .sticky.top-0,[data-theme=dark] #sidebar-content .sticky.top-0,html.dark #sidebar-content .sticky.top-0{background:0 0!important;background-image:none!important}.build_ai_app_container .banner_div{background:linear-gradient(332.46deg,rgba(144,158,158,.5) -12.26%,rgba(224,162,92,.5) 3.61%,rgba(220,162,96,.5) 30.33%,rgba(177,166,139,.5) 49.27%,rgba(151,159,155,.5) 74.49%,rgba(133,152,158,.5) 96.19%)}.dark .build_ai_app_container .banner_div,.dark .usecase_card .image_div{background:#0d1b2f}#content-area a[href^=\"https://origin.arc.io\"],.build_ai_app_container a,a.get_started_btn{border-bottom:none!important}.banner_card span{display:block;line-height:1.5}.usecase_card .image_div{background:linear-gradient(304.23deg,rgba(144,158,158,.5) .23%,rgba(224,162,92,.5) 15.13%,rgba(177,166,139,.5) 39.96%,rgba(151,159,155,.5) 71.24%,rgba(133,152,158,.5) 102.03%)}.dark .card{background:#1f2f44!important;border-color:rgba(255,255,255,.1)!important}.dark .card:hover{border-color:#acc6e9!important}.dark .card h2,.dark .card svg path:not(#card-link-arrow-icon svg path):not(.second_path),.dark .card svg:not(#card-link-arrow-icon svg):not(.second_path){color:#acc6e9!important;fill:#acc6e9!important;stroke:#acc6e9!important}.dark #content [class*=mint-bg-gray-50],.dark #content [class*=mint-bg-white],.dark #content-area [class*=mint-bg-gray-50],.dark #content-area [class*=mint-bg-white]{background-color:#1f2f44!important}.dark #content [class*=mint-bg-white][class*=mint-border],.dark #content-area [class*=mint-bg-white][class*=mint-border]{border-color:rgba(255,255,255,.1)!important}.dark #content [class*=mint-bg-white]:hover,.dark #content-area [class*=mint-bg-white]:hover{border-color:#acc6e9!important}.dark #content [class*=mint-bg-gray-50][class*=mint-border],.dark #content-area [class*=mint-bg-gray-50][class*=mint-border]{border-color:rgba(255,255,255,.1)!important}.dark #content [class*=mint-bg-gray-50]:hover,.dark #content-area [class*=mint-bg-gray-50]:hover{background-color:rgba(95,191,255,.1)!important;border-color:#acc6e9!important}.dark #page-context-menu *,.dark .accordion,.dark .accordion-group,.dark .card,.dark .code-block>:nth-child(2),.dark .code-block>:nth-child(3),.dark div[data-radix-popper-content-wrapper] *,.dark div[role=tabpanel]:has(>div[data-component-part=code-block-root])>:first-child{background:#1f2f44!important}.dark .accordion>:first-child:focus-visible,.dark .accordion>:first-child:hover{background:rgba(95,191,255,.15)!important}.dark .accordion-group,.dark .accordion-group details{border-color:rgba(255,255,255,.1)!important}.dark #assistant-entry,.dark #chat-assistant-sheet,.dark #mobile-nav,.dark #search-bar-entry,.dark .nav-anchor>div:has(>svg),.dark div:has(>div>#chat-assistant-textarea){background:#0d1b2f!important}.dark div[id^=headlessui-dialog-panel],.dark div[id^=headlessui-dialog-panel] [class*=bg-background],.dark div[id^=headlessui-dialog-panel]>*{background:#0d1b2f!important}.dark .chat-assistant-floating-input::before,html[data-current-path=\"/\"] .nav-tabs-item[data-active]>div{background:0 0!important}::-webkit-scrollbar{display:none}html{scrollbar-width:none}.dark #navbar>* :not(#banner):not(.nav-tabs-item[data-active]>div):not(.nav-tabs-item:hover>div){background:0 0!important}.dark :focus-visible,:focus-visible{outline:2px solid #3e74bb!important;outline-offset:2px!important}.dark :focus-visible{outline:2px solid #acc6e9!important}html:not(.dark) #navigation-items a[class*=bg-primary]{color:#3669ae!important}#navigation-items a:not([class*=bg-primary]){color:#6b6580!important}.dark #navigation-items a:not([class*=bg-primary]){color:#c7c5d1!important}#navbar a.nav-tabs-item,#navbar nav a,#search-bar-entry,#table-of-contents a{color:#6b6580!important}.dark #footer a[class*=text-gray-400],.dark #footer a[class*=text-gray-500],.dark #footer a[class*=text-gray-950],.dark #footer a[class*=text-white],.dark #navbar a.nav-tabs-item,.dark #navbar nav a,.dark #search-bar-entry,.dark #table-of-contents a{color:#c7c5d1!important}#content-area .mint-text-center>div[class*=mint-justify-center]{display:none!important}#content-area h1[class*=mint-text-]{font-size:3rem!important;line-height:3rem!important;font-weight:100!important}#content-area h2[class*=mint-text-]{font-size:1.5rem!important;line-height:1.75rem!important;font-weight:300!important}[data-testid^=mode-switch]{color:#4b5563!important}.dark [data-testid^=mode-switch]{color:#a7a3b5!important}.dark .callout[data-callout-type=note]{background:#1894e84d!important;border-color:#88b0e6!important}.dark .callout[data-callout-type=note]>div{color:#fff!important}.dark .callout[data-callout-type=note] svg{color:#88b0e6!important}.dark .callout[data-callout-type=check],.dark .callout[data-callout-type=tip]{background:#62e2a433!important;border-color:#8dd89f!important}.dark .callout[data-callout-type=check] svg,.dark .callout[data-callout-type=tip] svg{color:#8dd89f!important}.dark .callout[data-callout-type=warning]{background:#fed74d33!important;border-color:#ffe27c!important}.dark .callout[data-callout-type=warning] svg{color:#ffe27c!important}.dark .callout[data-callout-type=caution],.dark .callout[data-callout-type=danger]{background:#d42c3d4d!important;border-color:#e86d7a!important}.dark .callout[data-callout-type=caution] svg,.dark .callout[data-callout-type=danger] svg{color:#e86d7a!important}#footer a[class*=text-gray-400],#footer a[class*=text-gray-500],#footer a[class*=text-gray-950],#footer a[class*=text-white]{color:#6b6580!important}#footer svg.bg-gray-500,#footer svg.bg-gray-600,#footer svg[style*=mask-image]{background-color:#6b6580!important}#footer a:hover svg.bg-gray-500,#footer a:hover svg.bg-gray-600,#footer a:hover svg[style*=mask-image]{background-color:#4a4560!important}.dark #footer svg.bg-gray-500,.dark #footer svg.bg-gray-600,.dark #footer svg[style*=mask-image]{background-color:#c7c5d1!important}.dark #footer a:hover svg.bg-gray-500,.dark #footer a:hover svg.bg-gray-600,.dark #footer a:hover svg[style*=mask-image]{background-color:#e5e4ed!important}#footer>div>div:has(a[href*=mintlify]){display:none!important}.cw-card{background:#f5f7fa;border:1px solid rgba(0,0,0,.08)}.dark .cw-card{background:#1f2f44;border-color:rgba(255,255,255,.1)}.cw-btn-primary{background:#3e74bb;color:#fff;transition:background .15s ease}.cw-btn-primary:hover{background:#34649f}.dark .cw-btn-primary{color:#f5f5f8}.dark .cw-btn-primary:hover{background:#4a82cc}.cw-btn-primary:disabled{opacity:.6;cursor:not-allowed}.cw-text-accent{color:#3e74bb}.dark .cw-text-accent{color:#acc6e9}.cw-text-body{color:#1a1a2e}.dark .cw-text-body{color:#f5f5f8}.cw-text-subtle{color:#6b6580}.dark .cw-text-subtle{color:#c7c5d1}.cw-badge-connected{background:rgba(34,197,94,.1);color:#16a34a}.dark .cw-badge-connected{background:rgba(98,226,164,.2);color:#8dd89f}.cw-icon{color:#3e74bb}.dark .cw-icon{color:#acc6e9}.cw-error{color:#dc2626}.dark .cw-error{color:#e86d7a}.cw-wallet-option{background:rgba(0,0,0,.03)}.cw-wallet-option:hover{background:rgba(0,0,0,.07)}.dark .cw-wallet-option{background:rgba(255,255,255,.05)}.dark .cw-wallet-option:hover{background:rgba(255,255,255,.1)}.cw-wallet-icon-fallback{background:rgba(62,116,187,.1)}.dark .cw-wallet-icon-fallback{background:rgba(172,198,233,.15)}#arc-faucet-modal{position:fixed;z-index:9999;opacity:0;transform:translateY(-8px);transition:opacity 180ms ease-in-out,transform 180ms ease-in-out;pointer-events:none}#arc-faucet-modal.arc-faucet-modal-visible{opacity:1;transform:translateY(0);pointer-events:auto}#arc-faucet-modal[hidden]{display:none!important}.arc-faucet-dialog{position:relative;width:100%;height:100%;background:#fff;border:1px solid rgba(13,27,47,.08);border-radius:12px;box-shadow:0 16px 40px rgba(8,14,26,.18),0 4px 12px rgba(8,14,26,.1);overflow:hidden;outline:0;display:flex;flex-direction:column}.dark .arc-faucet-dialog,[data-theme=dark] .arc-faucet-dialog,html.dark .arc-faucet-dialog{background:#0d1b2f;border-color:rgba(255,255,255,.08);box-shadow:0 16px 40px rgba(0,0,0,.5),0 4px 12px rgba(0,0,0,.3)}.arc-faucet-close,.arc-faucet-loading{position:absolute;align-items:center;justify-content:center}.arc-faucet-close{top:10px;right:10px;z-index:2;display:inline-flex;width:32px;height:32px;border:0;border-radius:50%;background:rgba(13,27,47,.06);color:#0d1b2f;cursor:pointer;transition:background 120ms ease-in-out}.arc-faucet-close:hover{background:rgba(13,27,47,.12)}.dark .arc-faucet-close,[data-theme=dark] .arc-faucet-close,html.dark .arc-faucet-close{background:rgba(255,255,255,.08);color:#f5f5f8}.dark .arc-faucet-close:hover,[data-theme=dark] .arc-faucet-close:hover,html.dark .arc-faucet-close:hover{background:rgba(255,255,255,.16)}.arc-faucet-loading{inset:0;display:flex;font-family:var(--font-body, \"DM Sans\", sans-serif);font-size:.875rem;color:#6b6580}.dark .arc-faucet-loading,[data-theme=dark] .arc-faucet-loading,html.dark .arc-faucet-loading{color:#c7c5d1}.arc-faucet-iframe{flex:1 1 auto;width:100%;height:100%;border:0;background:0 0}.arc-faucet-picker{display:none;flex:1 1 auto;flex-direction:column;padding:44px 14px 14px;overflow:hidden}.arc-faucet-dialog[data-view=picker] .arc-faucet-iframe,.arc-faucet-dialog[data-view=picker] .arc-faucet-loading{display:none}.arc-faucet-dialog[data-view=picker] .arc-faucet-picker{display:flex}.arc-faucet-picker-header{display:flex;align-items:center;gap:10px;margin-bottom:12px}.arc-faucet-picker-back{background:0 0;border:0;padding:4px 8px;margin-left:-8px;font-size:.875rem;color:#6b6580;cursor:pointer;border-radius:6px}.arc-faucet-picker-back:hover{background:rgba(13,27,47,.06)}.dark .arc-faucet-picker-back,[data-theme=dark] .arc-faucet-picker-back,html.dark .arc-faucet-picker-back{color:#c7c5d1}.dark .arc-faucet-picker-back:hover,[data-theme=dark] .arc-faucet-picker-back:hover,html.dark .arc-faucet-picker-back:hover{background:rgba(255,255,255,.08)}.arc-faucet-picker-title{font-family:var(--font-body, \"DM Sans\", sans-serif);font-size:.9375rem;font-weight:600;color:#0d1b2f}.dark .arc-faucet-picker-title,[data-theme=dark] .arc-faucet-picker-title,html.dark .arc-faucet-picker-title{color:#f5f5f8}.arc-faucet-picker-list{display:flex;flex-direction:column;gap:4px;overflow-y:auto}.arc-faucet-picker-option{display:flex;align-items:center;gap:10px;padding:10px 12px;border-radius:8px;background:0 0;border:0;cursor:pointer;text-align:left;font:inherit;color:#0d1b2f;transition:background 120ms ease-in-out}.arc-faucet-picker-option:focus-visible,.arc-faucet-picker-option:hover{background:rgba(13,27,47,.06)}.arc-faucet-picker-option:disabled{opacity:.5;cursor:default}.arc-faucet-picker-option img{width:28px;height:28px;border-radius:6px}.dark .arc-faucet-picker-option,[data-theme=dark] .arc-faucet-picker-option,html.dark .arc-faucet-picker-option{color:#f5f5f8}.dark .arc-faucet-picker-option:focus-visible,.dark .arc-faucet-picker-option:hover,.dark .cw-picker-row:focus-visible,.dark .cw-picker-row:hover,[data-theme=dark] .arc-faucet-picker-option:focus-visible,[data-theme=dark] .arc-faucet-picker-option:hover,html.dark .arc-faucet-picker-option:focus-visible,html.dark .arc-faucet-picker-option:hover{background:rgba(255,255,255,.08)}.arc-faucet-picker-empty,.arc-faucet-picker-error{font-family:var(--font-body, \"DM Sans\", sans-serif);font-size:.8125rem;margin:8px 0 0}.arc-faucet-picker-error{color:#c5462d}.arc-faucet-picker-empty{color:#6b6580}.arc-faucet-picker-empty a{color:inherit;text-decoration:underline}.dark .arc-faucet-picker-error,[data-theme=dark] .arc-faucet-picker-error,html.dark .arc-faucet-picker-error{color:#ff8c70}.dark .arc-faucet-picker-empty,[data-theme=dark] .arc-faucet-picker-empty,html.dark .arc-faucet-picker-empty{color:#c7c5d1}@media (max-width:520px){#arc-faucet-modal{top:auto!important;bottom:0;left:0;right:0!important;transform:translateY(100%)}#arc-faucet-modal.arc-faucet-modal-visible{transform:translateY(0)}.arc-faucet-dialog{border-radius:16px 16px 0 0;width:100%;height:min(85vh,540px)}.arc-faucet-dialog::before{content:\"\";display:block;flex:0 0 auto;width:36px;height:4px;background:rgba(13,27,47,.18);border-radius:2px;margin:8px auto 4px}.dark .arc-faucet-dialog::before,[data-theme=dark] .arc-faucet-dialog::before,html.dark .arc-faucet-dialog::before{background:rgba(255,255,255,.24)}.arc-faucet-picker{padding-top:12px}}.cw-picker-row:focus-visible,.cw-picker-row:hover{background:rgba(13,27,47,.06)}.node-fee-manager rect{fill:#e8f5e9!important;stroke:#2e7d32!important}.dark .node-fee-manager rect{fill:#032b06!important}.node-module-calls rect{fill:#f5f5f5!important;stroke:#999!important;stroke-dasharray:5 5!important}.dark .node-module-calls rect,.dark .node-submit rect{fill:#4d4d4d!important}.node-submit rect{fill:#f5f5f5!important;stroke:#333!important}.node-finalized rect{fill:#e8f5e9!important;stroke:#2e7d32!important}.dark .node-finalized rect{fill:#032b06!important}html[data-current-path=\"/\"] .nav-tabs-item[data-active]:hover>div{background:#e5e7eb!important}html.dark[data-current-path=\"/\"] .nav-tabs-item[data-active]:hover>div{background:#374151!important}html[data-current-path=\"/\"] #navbar a.nav-tabs-item[data-active]{text-shadow:none!important}#your-privacy-choices-button{position:relative;align-self:start;font-size:.875rem!important;font-family:inherit}#your-privacy-choices-button::after{content:url(https://6778953.fs1.hubspotusercontent-na1.net/hubfs/6778953/legal/opt-out-30x14.svg);right:-34px;position:absolute}"}],"page":{"pagePath":"app-kit/tutorials/onramp/customize-session-minting","slug":"/app-kit/tutorials/onramp/customize-session-minting","pageMetadata":{"title":"Customize session minting","sidebarTitle":"Customize session minting","description":"Add authentication, customize error handling, or mint sessions from a host that does not use the Fetch API standard, such as Express or Fastify.","href":"/app-kit/tutorials/onramp/customize-session-minting"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Add authentication, customize error handling, or mint sessions from a host that does not use the Fetch API standard, such as Express or Fastify.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,li:`li`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,Heading,Note,Tab,Tabs}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Note)_missingMdxReference(`Note`,true);if(!Tab)_missingMdxReference(`Tab`,true);if(!Tabs)_missingMdxReference(`Tabs`,true);return _jsxs(_Fragment,{children:[_jsxs(_components.p,{children:[`The `,_jsx(_components.code,{children:`createSessionRouteHandler`}),` shipped with the App Kit SDK is a drop-in\nsession route for any host that uses the Fetch API standard (Next.js, Hono,\nCloudflare Workers, Bun, Deno, modern Node). The default handler is\nunauthenticated. Most apps need to customize it in these areas:`]}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`Authenticate so only signed-in users can mint sessions.`}),`\n`,_jsx(_components.li,{children:`Log or inspect session minting failures.`}),`\n`,_jsx(_components.li,{children:`Mint sessions from a host that does not use the Fetch API.`}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`add-authentication`,children:`Add authentication`}),`\n`,_jsxs(_components.p,{children:[`On Fetch-compatible hosts, create the handler once with\n`,_jsx(_components.code,{children:`createSessionRouteHandler`}),` and register it as `,_jsx(_components.code,{children:`POST /api/onramp/sessions`}),` in\nyour router. See the\n`,_jsx(_components.a,{href:`/app-kit/quickstarts/onramp-embed-widget`,children:`embed widget quickstart`}),` for a full\nexample.`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`10`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`10`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` createAppServerKit`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` createSessionRouteHandler`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`} `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"@circle-fin/app-kit/server\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` server`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` createAppServerKit`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` onramp:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`apiKey:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` process`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`env`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`CIRCLE_API_KEY`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`!`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`});`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` handleOnrampSession`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` createSessionRouteHandler`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`server`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`onramp`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`Add an `,_jsx(_components.code,{children:`authorize`}),` callback. The callback runs before the body is validated and\ncan return `,_jsx(_components.code,{children:`true`}),` (allow), `,_jsx(_components.code,{children:`false`}),` (reject with `,_jsx(_components.code,{children:`401`}),`), or throw a `,_jsx(_components.code,{children:`KitError`}),`\n(rejected with the corresponding status):`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`8`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`8`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`auth`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"@/lib/auth\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` handleOnrampSession`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` createSessionRouteHandler`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`server`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`onramp`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` authorize`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`:`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` async`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`request`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`=>`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` session`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` auth`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`request`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` session`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`?.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`user`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` !=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` null`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`});`})}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`You can also validate that the request body matches the signed-in user:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`9`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`9`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` handleOnrampSession`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` createSessionRouteHandler`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`server`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`onramp`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` authorize`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`:`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` async`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`request`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`=>`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` session`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` auth`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`request`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`!`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`session`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`?.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`user`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`return`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` false`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` body`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` request`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`clone`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`().`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`json`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`();`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` body`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`appUserId`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` ===`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` session`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`user`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`id`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`});`})}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`The handler’s body validation runs after `,_jsx(_components.code,{children:`authorize`}),` returns, so an\nunauthenticated request is rejected with `,_jsx(_components.code,{children:`401`}),` before any payload is parsed.`]}),`\n`,_jsx(Heading,{level:`2`,id:`customize-error-handling`,children:`Customize error handling`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`createSessionRouteHandler`}),` maps thrown errors to HTTP status codes\nautomatically. Using the same `,_jsx(_components.code,{children:`server`}),` and `,_jsx(_components.code,{children:`handleOnrampSession`}),` from above,\npass an `,_jsx(_components.code,{children:`onError`}),` callback:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`8`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`8`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` handleOnrampSession`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` createSessionRouteHandler`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`server`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`onramp`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` onError`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`error`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`request`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`=>`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` logger`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`error`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"onramp session mint failed\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` url:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` request`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`url`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` error`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` });`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`});`})}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`onError`}),` runs after the error is mapped to a response, so the response is still\nreturned. The callback is for observability. It does not change the status code\nor body.`]}),`\n`,_jsxs(_components.p,{children:[`See the `,_jsx(_components.a,{href:`/app-kit/references/onramp-error-handling`,children:`error handling reference`}),`\nfor the full error to status mapping.`]}),`\n`,_jsx(Heading,{level:`2`,id:`use-a-non-fetch-host`,children:`Use a non-Fetch host`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`createSessionRouteHandler`}),` only works on runtimes that pass standard `,_jsx(_components.code,{children:`Request`}),`\nobjects. Express and Fastify pass their own request and response objects, so\ncall `,_jsx(_components.code,{children:`server.onramp.createSession()`}),` directly instead. You’re now responsible\nfor the error mapping the Fetch handler did automatically.`]}),`\n`,_jsxs(_components.p,{children:[`Map `,_jsx(_components.code,{children:`KitError.type`}),` to HTTP status the same way `,_jsx(_components.code,{children:`createSessionRouteHandler`}),`\ndoes. See the\n`,_jsx(_components.a,{href:`/app-kit/references/onramp-error-handling#http-status-code-mapping`,children:`HTTP status code mapping`}),`\nfor the full mapping. Shape error response bodies to match your API.`]}),`\n`,_jsxs(Tabs,{children:[_jsx(Tab,{title:`Express`,id:`express`,children:_jsx(CodeBlock,{filename:``,numberOfLines:`41`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`41`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` express`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"express\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`createAppServerKit`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`KitError`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"@circle-fin/app-kit/server\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` server`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` createAppServerKit`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` onramp:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`apiKey:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` process`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`env`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`CIRCLE_API_KEY`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`!`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`});`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` app`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` express`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`();`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`app`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`use`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`express`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`json`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`());`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`app`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`post`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"/api/onramp/sessions\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`async`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`req`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`res`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`=>`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` try`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` session`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` server`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`onramp`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`createSession`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` appUserId:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` req`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`body`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`appUserId`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` destinationAddress:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` req`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`body`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`destinationAddress`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` });`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` res`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`setHeader`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Cache-Control\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"no-store\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` res`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`json`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`session`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`catch`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`error`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`error`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` instanceof`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` KitError`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` let`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` status`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 500`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` switch`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`error`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`type`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` case`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"INPUT\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` status`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 400`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` break`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` case`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"RATE_LIMIT\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` status`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 429`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` break`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` case`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"NETWORK\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` status`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 504`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` break`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` case`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"SERVICE\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` case`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"RPC\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` status`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 502`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` break`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` res`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`status`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`status`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`).`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`json`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({ `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`message:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` error`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`message`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` });`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` res`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`sendStatus`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`500`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`});`})}),`\n`]})})})}),_jsx(Tab,{title:`Fastify`,id:`fastify`,children:_jsx(CodeBlock,{filename:``,numberOfLines:`44`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`44`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` Fastify`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"fastify\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`createAppServerKit`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`KitError`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"@circle-fin/app-kit/server\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` server`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` createAppServerKit`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` onramp:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`apiKey:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` process`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`env`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`CIRCLE_API_KEY`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`!`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`});`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` app`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` Fastify`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`();`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`app`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`post`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"/api/onramp/sessions\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`async`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`request`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`reply`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`=>`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` try`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` body`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` request`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`body`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` as`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` appUserId`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` string`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` destinationAddress`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` string`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` };`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` session`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` server`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`onramp`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`createSession`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` appUserId:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` body`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`appUserId`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` destinationAddress:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` body`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`destinationAddress`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` });`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` reply`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`header`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Cache-Control\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"no-store\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` session`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`catch`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`error`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`error`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` instanceof`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` KitError`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` let`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` status`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 500`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` switch`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`error`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`type`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` case`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"INPUT\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` status`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 400`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` break`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` case`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"RATE_LIMIT\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` status`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 429`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` break`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` case`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"NETWORK\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` status`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 504`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` break`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` case`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"SERVICE\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` case`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"RPC\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` status`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 502`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` break`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` reply`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`status`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`status`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`).`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`send`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({ `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`message:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` error`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`message`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` });`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` reply`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`status`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`500`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`).`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`send`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`();`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`});`})}),`\n`]})})})})]}),`\n`,_jsx(_components.p,{children:`Add authentication in front of this route, like any other endpoint in your app.`}),`\n`,_jsx(Heading,{level:`2`,id:`limit-the-tokens-and-blockchains-the-widget-supports`,children:`Limit the tokens and blockchains the widget supports`}),`\n`,_jsxs(_components.p,{children:[`By default, the Onramp widget shows its full catalog of supported tokens and\nblockchains. If your app only handles a subset, pass an `,_jsx(_components.code,{children:`assets`}),` object on the\nsession request to narrow what the widget’s selector displays.`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`11`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`11`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` session`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` kit`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`onramp`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`fetchSession`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` url:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"/api/onramp/sessions\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` body:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` appUserId:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"user-123\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` destinationAddress:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"USER_WALLET_ADDRESS\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` assets:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` tokens:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` [`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"USDC\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`],`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` chains:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` [`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"arc\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`],`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`});`})}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`You can set any of three fields:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`tokens`}),`: an array of token symbols such as `,_jsx(_components.code,{children:`USDC`}),`, `,_jsx(_components.code,{children:`EURC`}),`, or `,_jsx(_components.code,{children:`ETH`}),`. The\nwidget shows those tokens on every blockchain that supports them.`]}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`chains`}),`: an array of blockchains, matched by either the network id (`,_jsx(_components.code,{children:`arc`}),`,\n`,_jsx(_components.code,{children:`base`}),`, `,_jsx(_components.code,{children:`ethereum`}),`) or the display label (`,_jsx(_components.code,{children:`Arc`}),`, `,_jsx(_components.code,{children:`Base`}),`, `,_jsx(_components.code,{children:`Ethereum`}),`). Matching\nis case-insensitive. The widget shows every supported token, restricted to\nthose blockchains.`]}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`pairs`}),`: an array of exact token and blockchain combinations. Use this when\nyou need finer control than `,_jsx(_components.code,{children:`tokens`}),` and `,_jsx(_components.code,{children:`chains`}),` allow.`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`6`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`6`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#C8C8C8`},children:`assets`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#C8C8C8`},children:` pairs`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`token:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"USDC\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`chain:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"arc\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`token:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"EURC\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`chain:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"base\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ],`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`]}),`\n`]}),`\n`,_jsxs(_components.p,{children:[`If you set more than one field, the widget only shows options that match every\nfield you set. Omit `,_jsx(_components.code,{children:`assets`}),` to show the full set of supported tokens and\nblockchains. See\n`,_jsx(_components.a,{href:`/app-kit/references/supported-blockchains`,children:`Supported blockchains and tokens`}),`\nfor the current list.`]}),`\n`,_jsx(Note,{children:_jsxs(_components.p,{children:[_jsx(_components.code,{children:`assets`}),` scopes what the selector displays. It doesn’t override the widget’s\neligibility, geo, or quote logic. A token or blockchain listed in `,_jsx(_components.code,{children:`assets`}),` can\nstill be unavailable for a specific user if they’re geo-blocked or otherwise\nineligible.`]})}),`\n`,_jsx(Heading,{level:`2`,id:`allow-your-page-to-embed-the-widget`,children:`Allow your page to embed the widget`}),`\n`,_jsxs(_components.p,{children:[`The widget page enforces a `,_jsx(_components.code,{children:`frame-ancestors`}),` Content Security Policy so only\napproved parent sites can embed it. The allowlist is built from a\n`,_jsx(_components.code,{children:`referrerDomain`}),` you set when constructing the server kit.`]}),`\n`,_jsxs(_components.p,{children:[`Pass it as a bare hostname on `,_jsx(_components.code,{children:`createAppServerKit`}),`:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`6`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`6`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` server`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` createAppServerKit`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` onramp:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` apiKey:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` process`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`env`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`CIRCLE_API_KEY`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`!`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` referrerDomain:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"your.domain.com\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`});`})}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`Keep the following in mind when setting `,_jsx(_components.code,{children:`referrerDomain`}),`:`]}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Format:`}),` Use a single bare hostname such as `,_jsx(_components.code,{children:`app.example.com`}),` or\n`,_jsx(_components.code,{children:`localhost`}),`. Don’t include a scheme, port, or path.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Source:`}),` Derive `,_jsx(_components.code,{children:`referrerDomain`}),` server-side from your app’s\nper-environment config. A browser-supplied `,_jsx(_components.code,{children:`Origin`}),` or `,_jsx(_components.code,{children:`Referer`}),` header would\nlet attackers widen the allowlist.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Sandbox:`}),` `,_jsx(_components.code,{children:`referrerDomain`}),` isn’t enforced. Set it anyway to verify your\nwiring before promoting to production.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Production:`}),` Debit card, Apple Pay, and Google Pay flows fail with a 403 if\nthe domain isn’t registered in your KYB’s `,_jsx(_components.code,{children:`web_url`}),` entries.`]}),`\n`]})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Customize session minting","sidebarTitle":"Customize session minting","description":"Add authentication, customize error handling, or mint sessions from a host that does not use the Fetch API standard, such as Express or Fastify.","href":"/app-kit/tutorials/onramp/customize-session-minting"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Add authentication","slug":"add-authentication","depth":2,"children":[]},{"title":"Customize error handling","slug":"customize-error-handling","depth":2,"children":[]},{"title":"Use a non-Fetch host","slug":"use-a-non-fetch-host","depth":2,"children":[]},{"title":"Limit the tokens and blockchains the widget supports","slug":"limit-the-tokens-and-blockchains-the-widget-supports","depth":2,"children":[]},{"title":"Allow your page to embed the widget","slug":"allow-your-page-to-embed-the-widget","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":["/_mintlify/custom/arcio-docs/8f78290d7c60f1f5/disclaimer-injector.js","/_mintlify/custom/arcio-docs/6ce1304cc70cc9ee/faucet-modal-injector.js","/_mintlify/custom/arcio-docs/f10ce4190f460fce/wallet-bus.js","/_mintlify/custom/arcio-docs/c8e2350d52e1c966/gtm.js"],"subdomain":"arcio-docs","siteName":"Arc Docs","title":"Customize session minting - Arc Docs","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-09-16T01:13:25.617Z","originalFileLocation":"app-kit/tutorials/onramp/customize-session-minting.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"dark\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Add authentication, customize error handling, or mint sessions from a host that does not use the Fetch API standard, such as Express or Fastify.\">\u003cmeta data-mint-head name=\"application-name\" content=\"Arc Docs\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/arcio-docs/ugo0LlJBZEAW3ukk/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/arcio-docs/ugo0LlJBZEAW3ukk/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/arcio-docs/ugo0LlJBZEAW3ukk/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/arcio-docs/ugo0LlJBZEAW3ukk/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/arcio-docs/ugo0LlJBZEAW3ukk/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/arcio-docs/ugo0LlJBZEAW3ukk/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/arcio-docs/ugo0LlJBZEAW3ukk/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/arcio-docs/ugo0LlJBZEAW3ukk/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/arcio-docs/ugo0LlJBZEAW3ukk/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Customize session minting - Arc Docs\">\u003cmeta data-mint-head property=\"og:description\" content=\"Add authentication, customize error handling, or mint sessions from a host that does not use the Fetch API standard, such as Express or Fastify.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Arc Docs\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.arc.io/app-kit/tutorials/onramp/customize-session-minting\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://docs.arc.io/arc-docs.jpg\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Customize session minting - Arc Docs\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Add authentication, customize error handling, or mint sessions from a host that does not use the Fetch API standard, such as Express or Fastify.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://docs.arc.io/arc-docs.jpg\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/arcio-docs/ugo0LlJBZEAW3ukk/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Arc Docs\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#3E74BB\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.arc.io/app-kit/tutorials/onramp/customize-session-minting\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/app-kit/tutorials/onramp/customize-session-minting.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.arc.io/#organization\",\"name\":\"Arc Docs\",\"url\":\"https://docs.arc.io\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/arcio-docs/ZZqL_C61H0lLVlWZ/logo/ARC_Doc_FC.svg?fit=max\u0026auto=format\u0026n=ZZqL_C61H0lLVlWZ\u0026q=85\u0026s=6d67e0bee7674d1506373511501be1cd\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.arc.io#website\",\"name\":\"Arc Docs\",\"url\":\"https://docs.arc.io\",\"publisher\":{\"@id\":\"https://docs.arc.io/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.arc.io/app-kit/tutorials/onramp/customize-session-minting#webpage\",\"url\":\"https://docs.arc.io/app-kit/tutorials/onramp/customize-session-minting\",\"name\":\"Customize session minting\",\"description\":\"Add authentication, customize error handling, or mint sessions from a host that does not use the Fetch API standard, such as Express or Fastify.\",\"dateModified\":\"2026-09-16T01:13:25.617Z\",\"isPartOf\":{\"@id\":\"https://docs.arc.io#website\"},\"breadcrumb\":{\"@id\":\"https://docs.arc.io/app-kit/tutorials/onramp/customize-session-minting#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.arc.io/app-kit/tutorials/onramp/customize-session-minting#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Onramp\",\"item\":\"https://docs.arc.io/app-kit/onramp\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Customize session minting\",\"item\":\"https://docs.arc.io/app-kit/tutorials/onramp/customize-session-minting\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.arc.io/app-kit/tutorials/onramp/customize-session-minting#article\",\"headline\":\"Customize session minting\",\"name\":\"Customize session minting\",\"description\":\"Add authentication, customize error handling, or mint sessions from a host that does not use the Fetch API standard, such as Express or Fastify.\",\"url\":\"https://docs.arc.io/app-kit/tutorials/onramp/customize-session-minting\",\"mainEntityOfPage\":{\"@id\":\"https://docs.arc.io/app-kit/tutorials/onramp/customize-session-minting#webpage\"},\"image\":\"https://docs.arc.io/arc-docs.jpg\",\"dateModified\":\"2026-09-16T01:13:25.617Z\",\"publisher\":{\"@id\":\"https://docs.arc.io/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.arc.io#website\"}}]}\u003c/script>","siteName":"Arc Docs","nav":{"global":null,"tabs":[{"tab":"Arc Network","pages":[{"title":"Arc Network","href":"/arc-chain"}]},{"tab":"Integrate","pages":[{"title":"Integrate","href":"/integrate"}]},{"tab":"Build","pages":[{"title":"Build","href":"/build"}]},{"tab":"App Kits","pages":[{"title":"App Kits","sidebarTitle":"App Kits overview","href":"/app-kit"},{"title":"Install the App Kit SDK","sidebarTitle":"Installation","href":"/app-kit/tutorials/installation"},{"title":"App Kits supported blockchains and tokens","sidebarTitle":"Supported blockchains and tokens","href":"/app-kit/references/supported-blockchains"},{"title":"Adapter setups","href":"/app-kit/tutorials/adapter-setups"},{"group":"Send","pages":[{"title":"App Kit SDK: Send","sidebarTitle":"Send overview","href":"/app-kit/send"},{"title":"Quickstart: Send tokens across wallets on the same blockchain","sidebarTitle":"Send tokens across wallets","href":"/app-kit/quickstarts/send-tokens-same-chain"}]},{"group":"Bridge","pages":[{"title":"App Kit SDK: Bridge","sidebarTitle":"Bridge overview","href":"/app-kit/bridge"},{"title":"Quickstart: Bridge tokens across blockchains","sidebarTitle":"Bridge tokens across blockchains","href":"/app-kit/quickstarts/bridge-tokens-across-blockchains"},{"title":"How bridge fees work","sidebarTitle":"How bridge fees work","href":"/app-kit/concepts/bridge-fees"},{"group":"Customize bridging","pages":[{"title":"How-to: Collect custom bridge fees","sidebarTitle":"Collect custom bridge fees","href":"/app-kit/tutorials/bridge/collect-bridge-fee"},{"title":"How-to: Estimate costs before bridging","sidebarTitle":"Estimate costs","href":"/app-kit/tutorials/bridge/estimate-costs"},{"title":"How-to: Use Forwarding Service","sidebarTitle":"Use Forwarding Service","href":"/app-kit/tutorials/bridge/use-forwarding-service"},{"title":"How-to: Pay fees on the source chain","sidebarTitle":"Pay fees on the source chain","href":"/app-kit/tutorials/bridge/pay-fees-on-source"},{"title":"How-to: Configure transfer speed and maximum cost","sidebarTitle":"Configure transfer speed and maximum cost","href":"/app-kit/tutorials/bridge/configure-transfer-speed"},{"title":"How-to: Specify a recipient address","sidebarTitle":"Specify a recipient address","href":"/app-kit/tutorials/bridge/specify-recipient-address"}]},{"title":"Error recovery and troubleshooting for bridges","sidebarTitle":"Error recovery","href":"/app-kit/references/bridge-error-recovery"}]},{"group":"Swap","pages":[{"title":"App Kit SDK: Swap","sidebarTitle":"Swap overview","href":"/app-kit/swap"},{"group":"Quickstarts","pages":[{"title":"Quickstart: Swap tokens on a blockchain","sidebarTitle":"Swap tokens on a chain","href":"/app-kit/quickstarts/swap-tokens-same-chain"},{"title":"Quickstart: Swap tokens across blockchains","sidebarTitle":"Swap tokens across chains","href":"/app-kit/quickstarts/swap-tokens-crosschain"}]},{"title":"How swap fees work","sidebarTitle":"How swap fees work","href":"/app-kit/concepts/swap-fees"},{"group":"Customize swapping","pages":[{"title":"How-to: Collect custom swap fees","sidebarTitle":"Collect custom swap fees","href":"/app-kit/tutorials/swap/collect-swap-fee"},{"title":"How-to: Estimate swap rate","sidebarTitle":"Estimate swap rate","href":"/app-kit/tutorials/swap/estimate-swap-rate"},{"title":"How-to: Set slippage tolerance or stop limit on swaps","sidebarTitle":"Set slippage tolerance or stop limit","href":"/app-kit/tutorials/swap/set-slippage-tolerance-or-stop-limit"},{"title":"How-to: Specify a recipient address","sidebarTitle":"Specify a recipient address","href":"/app-kit/tutorials/swap/specify-recipient-address"},{"title":"How-to: Get token rates","sidebarTitle":"Get token rates","href":"/app-kit/tutorials/swap/get-token-rates"}]}]},{"group":"Unified Balance","pages":[{"title":"App Kit SDK: Unified Balance","sidebarTitle":"Unified Balance overview","href":"/app-kit/unified-balance"},{"group":"Quickstarts","pages":[{"title":"Quickstart: Deposit and spend a Unified Balance","sidebarTitle":"Deposit and spend a Unified Balance","href":"/app-kit/quickstarts/unified-balance-deposit-and-spend"},{"title":"Quickstart: Use a delegate to deposit and spend a Unified Balance","sidebarTitle":"Use a delegate to deposit and spend a Unified Balance","href":"/app-kit/quickstarts/unified-balance-delegate-deposit-and-spend"}]},{"title":"How Unified Balance fees work","sidebarTitle":"How Unified Balance fees work","href":"/app-kit/concepts/unified-balance-fees"},{"title":"How-to: Check Unified Balance total","sidebarTitle":"Check Unified Balance total","href":"/app-kit/tutorials/unified-balance/check-unified-balance"},{"group":"Customize Unified Balance","pages":[{"title":"How-to: Use fast deposits","sidebarTitle":"Use fast deposits","href":"/app-kit/tutorials/unified-balance/use-fast-deposits"},{"title":"How-to: Select source blockchains for a Unified Balance spend","sidebarTitle":"Select source blockchains","href":"/app-kit/tutorials/unified-balance/select-source-blockchains"},{"title":"How-to: Estimate spend fees","sidebarTitle":"Estimate spend fees","href":"/app-kit/tutorials/unified-balance/estimate-spend-fees"},{"title":"How-to: Collect custom spend fees","sidebarTitle":"Collect custom spend fees","href":"/app-kit/tutorials/unified-balance/collect-custom-spend-fees"},{"title":"How-to: Manage delegates","sidebarTitle":"Manage delegates","href":"/app-kit/tutorials/unified-balance/manage-delegates"},{"title":"How-to: Use Forwarding Service","sidebarTitle":"Use Forwarding Service","href":"/app-kit/tutorials/unified-balance/use-forwarding-service"},{"title":"How-to: Remove funds trustlessly","sidebarTitle":"Remove funds trustlessly","href":"/app-kit/tutorials/unified-balance/remove-funds-trustlessly"}]},{"title":"Troubleshoot Unified Balance deposits","sidebarTitle":"Error recovery","href":"/app-kit/references/unified-balance-error-recovery"}]},{"group":"Onramp","pages":[{"title":"App Kit SDK: Onramp","sidebarTitle":"Onramp overview","href":"/app-kit/onramp"},{"title":"Quickstart: Embed the Onramp widget","sidebarTitle":"Embed the Onramp widget","href":"/app-kit/quickstarts/onramp-embed-widget"},{"title":"Onramp hosting requirements","sidebarTitle":"Hosting requirements","description":"Page-level constraints, Content Security Policy directives, container sizing rules for hosting the Onramp widget.","href":"/app-kit/references/onramp-hosting-requirements"},{"group":"Build your Onramp integration","pages":[{"title":"Customize session minting","sidebarTitle":"Customize session minting","href":"/app-kit/tutorials/onramp/customize-session-minting"},{"title":"Choose iframe or popup mode","sidebarTitle":"Choose iframe or popup","description":"Decide between mounting the Onramp widget inline as an iframe or launching it in a popup window, and handle the cases where popups are blocked.","href":"/app-kit/tutorials/onramp/iframe-vs-popup"},{"title":"Handle lifecycle events","sidebarTitle":"Handle lifecycle events","href":"/app-kit/tutorials/onramp/handle-lifecycle-events"},{"title":"How-to: Confirm a purchase onchain","sidebarTitle":"Confirm a purchase onchain","href":"/app-kit/tutorials/onramp/confirm-purchase-onchain"}]},{"title":"Onramp error handling","sidebarTitle":"Error handling","href":"/app-kit/references/onramp-error-handling"}]},{"group":"Earn","pages":[{"title":"App Kit SDK: Earn","sidebarTitle":"Earn overview","href":"/app-kit/earn"},{"title":"Quickstart: Deposit into an Earn vault","sidebarTitle":"Deposit into an Earn vault","href":"/app-kit/quickstarts/earn-deposit"},{"title":"Quickstart: Withdraw from an Earn vault","sidebarTitle":"Withdraw from an Earn vault","href":"/app-kit/quickstarts/earn-withdraw"},{"group":"Manage your Earn integration","pages":[{"title":"How-to: Preview Earn operations","sidebarTitle":"Preview operations","href":"/app-kit/tutorials/earn/preview-operations"},{"title":"How-to: Check your Earn position","sidebarTitle":"Check your position","href":"/app-kit/tutorials/earn/check-position"},{"title":"How-to: Deposit crosschain into an Earn vault","sidebarTitle":"Crosschain deposit","href":"/app-kit/tutorials/earn/crosschain-deposit"}]},{"title":"How Earn fees work","sidebarTitle":"How Earn fees work","href":"/app-kit/concepts/earn-fees"},{"title":"Earn error handling","sidebarTitle":"Error handling","href":"/app-kit/references/earn-error-handling"}]},{"group":"Borrow","pages":[{"title":"App Kit SDK: Borrow","sidebarTitle":"Borrow overview","href":"/app-kit/borrow"},{"title":"Quickstart: Originate a loan","sidebarTitle":"Originate a loan","href":"/app-kit/quickstarts/originate-a-loan"},{"title":"How loan health works","sidebarTitle":"How loan health works","href":"/app-kit/concepts/borrow-loan-health"},{"group":"Fees","pages":[{"title":"How borrow fees work","sidebarTitle":"How borrow fees work","href":"/app-kit/concepts/borrow-fees"},{"title":"How-to: Configure your integrator fee","sidebarTitle":"Configure integrator fee","href":"/app-kit/howtos/borrow/configure-integrator-fee"}]},{"group":"Loan operations","pages":[{"group":"Quotes","pages":[{"title":"How-to: Preview Borrow operations","sidebarTitle":"Preview operations","href":"/app-kit/howtos/borrow/preview-a-loan-operation"},{"title":"Borrow quote methods","sidebarTitle":"Quote methods","href":"/app-kit/references/borrow-quote-methods"}]},{"group":"Progress","pages":[{"title":"How-to: Track operation progress","sidebarTitle":"Track operation progress","href":"/app-kit/howtos/borrow/track-operation-progress"},{"title":"Borrow phase events","sidebarTitle":"Phase events","href":"/app-kit/references/borrow-phase-events"}]},{"title":"How-to: Use idempotency keys","sidebarTitle":"Use idempotency keys","href":"/app-kit/howtos/borrow/use-idempotency-keys"}]},{"group":"Manage loans","pages":[{"title":"How-to: Add collateral or borrow more against a loan","sidebarTitle":"Add collateral or borrow more","href":"/app-kit/howtos/borrow/add-collateral-or-borrow-more"},{"title":"How-to: Pay down a loan","sidebarTitle":"Pay down a loan","href":"/app-kit/howtos/borrow/pay-down-a-loan"},{"title":"How-to: Monitor a loan","sidebarTitle":"Monitor a loan","href":"/app-kit/howtos/borrow/monitor-a-loan"}]},{"title":"Error handling for Borrow","sidebarTitle":"Error handling","href":"/app-kit/references/borrow-error-handling"}]},{"title":"App Kit SDK Reference","sidebarTitle":"SDK Reference","href":"/app-kit/references/sdk-reference"}]}]},"basePath":"","title":"Customize session minting - Arc Docs","buildId":"dpl_G9nrg4qeJSZtah1Ziwbc2n6WkLch","deploymentId":"dpl_G9nrg4qeJSZtah1Ziwbc2n6WkLch","dynamics":["10e4515597"],"chunks":["BannerMarkdown-CXEEkV6J.js","dist-lvhuD9Du.js","lib-DuNMoZ05.js","lib-B8HbPgcC.js","clsx-D1Z-ELXV.js","html-void-elements-mCSPHezU.js","katex-YMM-FMeD.js","marked.esm-CZWythHk.js"]}