From 1652398ff272bcd77455c6e3d6e0d0631d6a2305 Mon Sep 17 00:00:00 2001 From: Anthony Ettinger Date: Mon, 30 Nov 2026 19:29:29 +0000 Subject: [PATCH] feat: /crawl day-pass endpoint and /hooks/coinpay webhook With COINPAY_X402_KEY + CRAWL_PAY_TO set, callers over the free limit get a 402 offering a $1 day pass; /crawl now serves the gateway's sales page and settle endpoint instead of a 404. The CoinPay business webhook is acknowledged at /hooks/coinpay. Co-Authored-By: Claude Opus 5.5 --- src/app.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/app.js b/src/app.js index 805c319..049136d 100644 --- a/src/app.js +++ b/src/app.js @@ -137,6 +137,13 @@ app.all('/mcp', async (c) => { return handleMcp(c.req.raw); }); +// The day-pass sales page and x402 settle endpoint (only with the paid tier on). +app.all('/crawl', async (c) => (gateway && (await gateway.handle(c.req.raw))) || c.text('not found', 404)); + +// CoinPay business webhook. Day passes settle synchronously over x402 or the +// gateway checkout return page, so events are only acknowledged here. +app.post('/hooks/coinpay', (c) => c.body(null, 204)); + app.get('/health', (c) => c.json({ ok: true, version: VERSION })); app.get('/', async (c) => c.html(await homePage())); app.get('/docs', async (c) => c.html(await docsPage()));