Four frontend skills are on sale now. Pay once, download straight away with your licence key.

See the catalogue
AI Skill Up
Browse skills

Test-mode checkout pitfalls: how a shop takes no money without an error

A test-mode checkout takes only test cards, so a live page linked to it fails real buyers silently. How it happens, and a build guard that makes it impossible.

Payment providers give you a test mode so you can buy things with fake cards. It is also the easiest way to run a shop that takes no money for a week without noticing: link the live site to the test checkout, and every real card is quietly refused.

How it slips through

  • Test and live are separate. Products, ids and entitlements must be created twice.
  • The checkout host differs only by a test. prefix, easy to miss in a URL.
  • Nothing errors. A declined real card on a test checkout is the system working.

Make the wrong combination refuse to build

Our checkout mode is a build setting: off, test or live. Each product carries both ids, { test, live }, and the checkout link is built from whichever the mode asks for. Then one guard: a build that is indexable and in test mode throws. The only way past it is a separate, explicitly named flag, and that flag puts an amber test-mode banner across the top of every page.

if (DODO_MODE === "test" && SITE.indexable && !TEST_ON_PRODUCTION) {
  throw new Error("Test checkout must never reach the production site.");
}

Two more that caught us

  1. The download service had its own mode setting. The deploy command now sets both together, so checkout and key checks cannot point at different worlds.
  2. Local development is always test mode, so nothing on localhost can take real money.

Before going live, make one real purchase and refund it. The rest of the shape is in selling downloads without a backend.

Questions

What happens if a live site links to a test-mode checkout?

Real cards are declined, and nothing alerts you, because from the provider's point of view a test checkout rejecting a real card is working correctly. Sales simply do not arrive.

Why do test and live need different product ids?

In most payment dashboards, test and live are separate worlds: a product created in test mode does not exist in live, and has a different id when you create it there.

How do I test the whole flow on the real domain?

Deliberately, with a visible banner on every page saying test mode, and switched back straight after. Make it take an explicit flag, never a default.

Or skip the afternoonand drop one in.

Every skill in the catalogue is a folder you drop into your skills directory. Each ships with its design rules, worked examples and a troubleshooting table, and downloads the moment you pay.