MuseMVP Docs
Billing

Dodo Payments

Configure the Dodo Payments gateway.

MuseMVP integrates Dodo Payments as one of its payment gateways. Through the unified Muse Billing module, it handles subscriptions, one-time purchases, and the customer portal with the same contract and access model as Creem, Stripe, and Waffo. This guide explains how to configure the Dodo gateway and understand how it works.

Set the default gateway

When Dodo Payments is your primary checkout provider, set the default gateway to muse_dodo in Admin → Runtime settings.

Gateway selection

You can still override the gateway per checkout request. The stored default is used by pricing and launch flows.

Get the Dodo API key

Retrieve your API key from the Dodo Payments Dashboard under Developer → API. Paste the API key and environment (test_mode or live_mode) into Admin → Runtime settings.

Key Security

Gateway credentials are encrypted in the database. Never expose them to the client or version control.

Get the Dodo webhook secret

In the Dodo Payments Dashboard, create a Webhook and set the callback URL to:

https://example.com/api/muse-billing/notify/muse_dodo

Select the event types to listen for (or all):

  • payment.succeeded
  • payment.failed
  • payment.processing
  • payment.cancelled
  • subscription.active
  • subscription.updated
  • subscription.on_hold
  • subscription.renewed
  • subscription.plan_changed
  • subscription.cancelled
  • subscription.failed
  • subscription.expired

Copy the webhook signing secret into Admin → Runtime settings. After saving, confirm the same secret is still configured on the Dodo side.

Key Security

The webhook secret is stored encrypted in the database. A mismatch with Dodo will reject every webhook.

Create products and get product IDs

Checkout product IDs are stored in Admin → Runtime settings (billing.productMap). The public pricing UI uses stable app plan IDs (pro_monthly, pro_yearly, lifetime).

After creating the corresponding products in the Dodo Payments Dashboard, paste the product IDs into the admin product map.

Local development testing

Download Ngrok

Ngrok (https://dashboard.ngrok.com/get-started/setup/windows) is a reverse proxy tool that exposes your local development server to the public internet.

Run

ngrok http 3000

Callback domain

Use the terminal domain shown above as the callback URL in your webhook configuration.

Switch to test mode

Ensure the Dodo environment in Admin → Runtime settings is test_mode and use Dodo Payments test mode in the Dashboard to run payment tests.

Test mode

Payments in Dodo test mode do not result in real charges, making it safe for local testing of subscription and one-time purchase flows.

How it works

Learn how Muse Billing integrates Dodo Payments into the system.

Integration files

src/modules/muse-billing/lib/gateways/dodo/gateway.ts
src/modules/muse-billing/lib/gateways/dodo/mappers.ts
src/backend/api/routes/muse-billing/router.ts
FilePurpose
dodo/gateway.tsDodo gateway implementation: checkout session launch, webhook parsing, customer portal.
dodo/mappers.tsMaps Dodo webhook events and subscription states into Muse contract snapshots.
router.tsAPI routes: exposes /api/muse-billing/* endpoints.

Core workflow

The action flow for payment and accessing the customer portal:

Frontend calls POST /api/muse-billing/launch with productId, optional gatewayId (defaults to orchestrator selection), etc.

Server resolves the Dodo product ID from the stored billing.productMap settings.

Creates a Dodo checkout session and returns launchUrl for the frontend to redirect to the hosted checkout page.

After payment, Dodo sends a webhook; the server verifies the signature and syncs contract lifecycle and access window to the database.

When the user needs to access the platform portal, call POST /api/muse-billing/customer-hub to get a redirect link to the Dodo customer portal for managing subscriptions or downloading receipts.

On this page