Answer

Braintree card test numbers are fake card numbers that return a set result in the Braintree sandbox. They do not touch a real card network and they do not move money.

Braintree Test Card: Sandbox Testing Guide

The default Visa number is 4111111111111111. The default Mastercard number is 5555555555554444. Both pass the Luhn check, so client side validation accepts them. Use any expiration date in the future, such as 12/2030. Use any 3 digit CVV, or 4 digits for American Express. Use a postal code in the format your gateway expects, such as 12345.

Cannot write this content

The production gateway rejects these numbers. A test number sent to production returns a decline or an error, not an approval.

related article

Sandbox card numbers that approve

  • Visa: 4111111111111111
  • Visa: 4012888888881881
  • Visa: 4005519200000004
  • Visa: 4012000033330026
  • Mastercard: 5555555555554444
  • Mastercard: 5105105105105100
  • American Express: 378282246310005
  • American Express: 371449635398431
  • Discover: 6011111111111117
  • JCB: 3530111333300000

Each number returns an authorization for the amount you send. The sandbox stores the transaction and shows it in the Control Panel under the sandbox merchant account.

braintree card authentication

Credentials and environment

Sandbox calls go to a separate host and use a separate merchant ID, public key, and private key. Keys from production do not work in the sandbox, and sandbox keys do not work in production. Confirm the environment flag in the server SDK before you run a test.

Most integrations create a payment method nonce on the client, then send the nonce to the server. Raw card numbers sent from the server are allowed in the sandbox, but the client token flow matches what production does.

Declines and error cases

Braintree does not decline a random test number. The sandbox declines only on numbers and values that the documentation lists for the processor tied to your sandbox merchant account. Two accounts on different processors can return different results for the same number.

CVV and AVS checks follow the same rule. Braintree publishes specific CVV and postal code values that force a mismatch. Read the current test value list for your processor before you write assertions against a decline code.

3D Secure

3D Secure tests use a separate set of card numbers. Each number maps to one authentication result, such as a pass, a failed challenge, or a Cardinal error. These numbers change more often than the basic approval numbers, so verify them in the Braintree docs before each release.

Common mistakes

  • Using a test number in production and reading the decline as a gateway bug.
  • Mixing a sandbox token with a production merchant ID.
  • Testing only the approval path and never the decline path.
  • Hard coding a 3 digit CVV for an American Express test card.
  • Assuming an amount triggers a decline. The sandbox ignores most amount based triggers.