- POST /api/checkout creates a live Dodo checkout session from an allowlisted product slug (weekly/monthly/pro/pro_annual/team), never a client-supplied product id. - POST /api/webhooks/dodo verifies the Standard Webhooks signature (webhook-id.webhook-timestamp.body, 5-min replay window) against a secret stored only as a Worker secret, records each delivery idempotently by webhook-id in D1, and upserts a per-customer entitlement row on subscription lifecycle events. - GET /api/entitlement is an internal-only lookup gated by a shared-secret header, for Recoder's app / Rithub to check a customer's billing state. - GET /api/portal resolves a checkout session's email, looks up the Dodo customer id from our own entitlements table, and redirects into Dodo's hosted customer portal -- no bespoke billing UI. - New /thanks page with a "Manage subscription" link; pricing cards now trigger checkout via one click (no form -- Dodo's hosted page collects email/card). - New D1 database recoder-billing (webhook_events + entitlements tables). This re-points recoder.xyz at a real backend: the live Dodo webhook (ep_3L0eElSCHnxNsth2aIBRdObJJzT) was 404ing against the old pure-static site. Verified live: bad signature -> 401, correctly-signed test event -> 200 + D1 row + idempotent replay, all 5 live checkout URLs return 200 on Dodo's hosted page, pricing/thanks screenshot clean at 1440 and 390 with no console errors. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
27 lines
609 B
JSON
27 lines
609 B
JSON
{
|
|
"$schema": "node_modules/wrangler/config-schema.json",
|
|
"name": "recoder-site",
|
|
"main": "src/index.js",
|
|
"compatibility_date": "2026-12-01",
|
|
"assets": {
|
|
"directory": "./public",
|
|
"binding": "ASSETS",
|
|
"html_handling": "auto-trailing-slash",
|
|
"not_found_handling": "404-page",
|
|
"run_worker_first": ["/api/*"]
|
|
},
|
|
"d1_databases": [
|
|
{
|
|
"binding": "DB",
|
|
"database_name": "recoder-billing",
|
|
"database_id": "4e1568d4-8e30-4ab5-a643-8ee87970ccc2",
|
|
"migrations_dir": "migrations"
|
|
}
|
|
],
|
|
"observability": {
|
|
"logs": {
|
|
"enabled": false
|
|
}
|
|
}
|
|
}
|