Now inviting automation leaders: publish your playbook as a skill, under your own name. Publish yours →
Automation Skills
All skills/Api test mode design/Magic-value-catalogs
Reference · Api test mode design

Magic-value-catalogs

Part of Api test mode design. Install the skill and your agent reads this page when it needs the depth.

Magic-value catalogs: worked examples across five product domains

A magic value is a fake input that is not random filler - it is a deterministic key that selects a specific test outcome. These catalogs show how five vendors shape the pattern to their domain. Treat every table below as a snapshot: vendors periodically update their lists (Stripe says so explicitly), so verify against the vendor's live testing docs before hard-coding any value into an automated suite.

Stripe: the card number is the key (payments)

The card number alone decides the outcome. Expiry, CVC, and ZIP can be anything valid. Test values don't expire - the catalog is a stable, long-lived contract integrators memorize, not a rotating fixture set.

Number Outcome
4242 4242 4242 4242 Always succeeds (the canonical happy path)
4000 0000 0000 0002 Generic decline (card_declined)
4000 0000 0000 9995 Insufficient funds - a distinct decline_code, so the integrator's UI can show specific messaging
4000 0000 0000 9987 / 9979 Lost card / stolen card
4000 0000 0000 0069 / 0127 / 0119 Expired card / incorrect CVC / processing error
4000 0000 0000 0259 Charge succeeds, then is disputed as fraudulent - tests dispute handling, not just declines
4100 0000 0000 0019 Fraud-review: always blocks (risk "highest")
4000 0000 0000 4954 / 9235 Highest risk but processes / elevated risk
4000 0027 6000 3184 3DS2 challenge required
4000 0025 0000 3155 Authentication required only on setup / off-session
4000 0000 0000 3220 3DS required on every transaction (always-challenge variant)
5555 5555 5555 4444 (MC), 3782 822463 10005 (Amex, 15 digits, 4-digit CVC) Non-Visa happy paths - cover more than one network

Two transferable lessons:

  1. Token over raw value: Stripe recommends a token (pm_card_visa) instead of a raw number in test code - raw sensitive values in server-side code become a compliance habit that carries into production paths.
  2. Bidirectional mode boundary: test values only work with test keys; a live key rejects them outright, and a real card in test mode violates the platform's terms. Enforce both directions, not just "live rejects test."

Twilio: magic numbers split by operation, restricted to test credentials (communications)

Test credentials can never touch real numbers or carriers - a request made with test credentials cannot even specify a live account number as From, so the only usable From is a documented magic number. No call is placed, no SMS sent, no status callbacks fire: the request never reaches a real network.

The catalog splits by operation type, and the same numeric suffix means different things across operations - a documented trap:

Note "can't route" is ...0002 for voice but SMS uses ...0009 for its closest equivalent - cross-referencing the wrong operation's table is an easy, documented mistake. Design lesson: one flat catalog for a multi-operation API invites exactly this confusion; label every value with the operation and field it applies to. For OTP flows there is no universal always-correct code - a reminder that not every domain admits a magic value.

Plaid: the username is the magic value (data aggregation)

PayPal: the name field drives the outcome (payments, contrast case)

Entering a rejection-trigger string (e.g. CCREJECT-REFUSED) in the "Name on Card" field, with any valid test card number, forces that decline - the opposite convention from Stripe, where the number itself varies. Trigger values are case-sensitive, and every rejection returns the same AVS/CVV placeholder values regardless of reason - so rejection reasons cannot be distinguished from those fields. The older Classic API puts magic values directly into transaction fields (amount, authorization ID, CVV2, street) for finer-grained negative testing.

Shopify and GitHub: the lightweight end of the spectrum

What the cross-domain comparison teaches

Publish your skill

Copy this prompt into Claude Code, Codex or any agent. It walks you through your first skill in about 20 minutes, with you as the author.

Click to copy.