Skip to Content
LaunchfastDocs

Switching to live payments

Move from Dodo's test mode to real payments. Live mode has its own API key, products and webhook, so all three change.

In Dodo, test mode and live mode are separate: each has its own API keys, products, customers and webhooks. Switching means getting a live version of each.

Before you start

Dodo must have verified your business. Until it has, the Live Mode switch in the Dodo sidebar isn't available. Complete the verification steps Dodo shows on its dashboard.

Switch

Create a live API key

In app.dodopayments.com, turn Live Mode on in the sidebar, then Developer → API Keys → Create New Key. Click Select all, choose Write, and leave IP Allowlist empty. Copy the key.

Run setup and redo Dodo

npm run setup
  1. Answer Yes to Deploy to Vercel at the end?
  2. Keep the database and the other finished steps.
  3. At Dodo Payments is already set up. Keep it? answer No, and paste the live key.

Setup prints Live mode key: checkout takes real payments. and creates live products for your plans (new pdt_… IDs).

Setup redeploys with live values

The deploy step copies the live key and product IDs to Vercel, registers the webhook in live mode, saves its new secret, and redeploys.

Make a real purchase

Buy your cheapest plan on the live site with a real card. Check that the dashboard unlocks, then refund the payment in Dodo.

Your computer now uses live mode too

Setup writes the live key to .env.local, so checkouts from localhost now charge real cards. See Keep testing locally.

What happens to test customers

A user who bought in test mode has a test-mode Dodo customer. When they check out in live mode, the kit sees that customer doesn't exist in live mode and creates a new one automatically. Nothing to do.

Clear test data

Test purchases stay in your database. They would show up as revenue in /admin, and test buyers of one-time plans would keep "paid" access. If production shares the database you tested with, clear the billing tables before your first real sale, in the Neon SQL editor:

-- Only before any real payments: this deletes all billing history.
delete from payment;
delete from subscription;
delete from billing_customer;

Accounts (users) are kept. If you also want to remove test accounts, delete them from the user table; their sessions and accounts are removed with them.

Keep testing locally

To keep using test mode on your computer while production is live:

  1. Keep a copy of your test values (API key, product IDs, webhook secret) somewhere safe before switching.
  2. After setup finishes, put the test values back in .env.local, with DODO_PAYMENTS_ENVIRONMENT=test_mode.

Setup copies .env.local to Vercel whenever you deploy with it. If .env.local holds test values, re-deploying with setup would put production back in test mode. After this point, change production values in the Vercel dashboard instead, or switch .env.local to live values before running setup with deploy.

A cleaner long-term setup is a separate database for production: then test data never reaches it. See Local and production share this database.

On this page