primer · dodo payments

Four Dodo primitives, demystified.

Every idea in this repo leans on the same rail: bun add dodopayments, one server function that calls Dodo, and one webhook route that verifies the Svix signature and flips the unlock. Four flavours — Checkout, Subscriptions, Adaptive Currency, Usage Billing — one SDK.

hosted one-time payment
Docs ↗

Dodo Checkout

Kernel: a Dodo `POST /payments` call that mints a one-time hosted checkout link for a digital deliverable, then verifies the resulting `payment.succeeded` webhook (Svix-signed HMAC-SHA256) before unlocking the goods

UI: a single Buy button that redirects to the Dodo-hosted checkout and, on return, reads a webhook-set cookie to reveal the download

recurring plans
Docs ↗

Dodo Subscriptions

Kernel: a Dodo Subscription Product powering a recurring plan — customer picks a tier, Dodo hosts the checkout and manages renewals, and the app reacts to `subscription.active` / `subscription.cancelled` / `subscription.on_hold` webhooks to gate features

UI: a plan-picker that opens the Dodo checkout for the selected tier and a member surface that mirrors the current subscription state live from webhooks

localized pricing
Docs ↗

Dodo Adaptive Currency

Kernel: Dodo Adaptive Currency: prices are declared once in USD and Dodo automatically presents the buyer's local currency at checkout, converting cleanly with no FX code — the returned Payment records the settled currency for the receipt

UI: a pricing surface that shows the base USD tag plus a live 'Pay in your currency at checkout' hint driven by Dodo's country routing

metered on-demand invoicing
Docs ↗

Dodo Usage Billing

Kernel: usage-based billing: the app meters events (renders, minutes, tokens, seats), posts them to Dodo, and issues an on-demand hosted invoice — the customer pays via Dodo checkout and a webhook clears the counter

UI: a metered dashboard showing the running counter, the pending charge, and an Invoice Now button that opens the Dodo hosted payment link

Two env vars. That's it.

Set these in Lovable under Settings → Secrets. Your TanStack server functions read them from process.env — nothing leaks to the browser and Dodo never sees your app code.

  • DODO_API_KEY

    Your Dodo Payments API key. Create one in the Dodo dashboard under Developer → API Keys. The demo defaults to test mode; flip DODO_MODE=live to charge real cards.

    Docs ↗
  • DODO_WEBHOOK_SECRET

    The signing secret Dodo reveals after you create a Webhook Endpoint (Webhooks → Endpoints → New Endpoint). Starts with whsec_. The webhook route verifies every request against this before unlocking the download.

    Docs ↗
Try the live demoBuild strategyBrowse 1,000 ideas