Testing

The Braintree sandbox allows end-to-end testing for each of the card brands supported in our 3D Secure integration. The following is a list of test numbers for various card brands:

Status and Scenario Card brand specific test values
"authenticate_successful"
Cardholder enrolled, authentication successful, and signature verification successful
Visa
  • 4000000000000002
  • 01/2020
Mastercard
  • 5200000000000007
  • 01/2020
Amex
  • 340000000003961
  • 01/2020
"authenticate_signature_verification_failed"
Cardholder enrolled, authentication successful, and signature verification unsuccessful
Visa
  • 4000000000000010
  • 01/2020
Mastercard
  • 5200000000000015
  • 01/2020
Amex
  • 340000000006022
  • 01/2020
"authenticate_failed"
Cardholder enrolled, authentication unsuccessful, and signature verification successful
Visa
  • 4000000000000028
  • 01/2020
Mastercard
  • 5200000000000023
  • 01/2020
Amex
  • 340000000000033
  • 01/2020
"lookup_error"
An error occurred while attempting to lookup enrollment
Visa
  • 4000000000000044
  • 01/2020
Mastercard
  • 5200000000000049
  • 01/2020
Amex
  • 340000000008309
  • 01/2020
"lookup_not_enrolled"
Cardholder not enrolled, and issuing bank not participating
Visa
  • 4000000000000051
  • 01/2020
Mastercard
  • 5200000000000056
  • 01/2020
Amex
  • 340000000008135
  • 01/2020
"authentication_unavailable"
Authentication unavailable for this transaction
Visa
  • 4000000000000069
  • 01/2020
Mastercard
  • 5200000000000064
  • 01/2020
Amex
  • 340000000007780
  • 01/2020
"authentication_unavailable"
Merchant not able to execute transactions
Visa
  • 4000000000000085
  • 01/2020
Mastercard
  • 5200000000000080
  • 01/2020
Amex
  • 340000000008416
  • 01/2020
"authenticate_error"
Cardholder enrolled, but there was error when attempting to authenticate
Visa
  • 4000000000000093
  • 01/2020
Mastercard
  • 5200000000000098
  • 01/2020
Amex
  • 340000000009299
  • 01/2020
"authentication_unavailable"
Cardholder enrolled, but authentication is not available for this transaction
Visa
  • 4000000000000036
  • 01/2020
Mastercard
  • 5200000000000031
  • 01/2020
Amex
  • 340000000002302
  • 01/2020
"authentication_bypassed"
Bypass used to simulate a scenario where merchant has elected to bypass the consumer authentication flow via CardinalCommerce Rules Engine configuration
Visa
  • 4000990000000004
  • 01/2020
Mastercard
  • 5200000000000031
  • 01/2020
Amex
  • 340099000000001
  • 01/2020

See the guide from CardinalCommerce, our 3D Secure authentication provider, for more details on the test card numbers above.

note

At this time, our 3D Secure integration with CardinalCommerce does not support cards that use JCB J/Secure, Protect Buy, or Elo Compra Segura.

Go live

important

Your sandbox account is not linked to your production account in any way. Nothing created in the sandbox will transfer to production. This includes processing options and recurring billing settings. Your login information, merchant ID, and API keys will also be different.

Create an API user

Production API credentials, including your API keys, must be entered into your server-side code to connect API calls to the Braintree gateway. While each user in your gateway has their own unique set of API keys, only one set can be included in your integration.

We do not recommend including an individual user's API credentials. If you ever need to delete or suspend that user, this could break your connection to Braintree and result in failed transactions.

Instead, create a new user specifically designated as the API user, whose API keys can be used for your integration. This user should be set up with an email address that is not associated with a single employee and should have Account Admin permissions in order to avoid issues such as an authorization error.

Get production credentials

Log into your production account as the API user to obtain your API credentials. You'll need the:

  • Production merchant ID
  • Production public key
  • Production private key

Keep in mind that public and private keys are both environment- and user-specific.

Update production account settings

Make sure your production account settings mirror the ones in your tested sandbox configuration. Be sure to recreate any recurring billing plans or settings if you plan to use recurring billing in production.

Update live server configuration

In your server code, update your configuration to production values:

PHP
Copy
Copied
$gateway = new Braintree_Gateway([
    'environment' => 'production',
    'merchantId' => 'use_your_merchant_id',
    'publicKey' => 'use_your_public_key',
    'privateKey' => 'use_your_private_key'
]);
This code snippet now uses gateway instance methods instead of class-level methods. Learn more.

Once you have updated these values and configured your preferred processing settings, the live production environment will function similarly to the sandbox environment you've been using for development. Learn more about the differences between production and the sandbox.

On the client side, no configuration updates are needed when you make the switch to production – your client obtains its client token from your server, which is all the configuration it needs.

note

If you have an iOS integration, verify that your released code does not use an offline client token by ensuring that you do not import BTClient+Offline.h. Once this is confirmed, you can publish to the App Store.

Test transactions in production

It is important to test your production account by creating a couple of low-value sale transactions for each of the payment method types you plan to accept. Be sure to submit the transactions for settlement, and then confirm that the funds have deposited into your bank account. This typically happens a few days after they have settled.

important

Real payment methods must be used in the production environment. Test values from the sandbox testing page will not work. This means that every test transaction that you allow to settle in your production account will debit funds from the associated payment method and fees will be assessed. Be sure to test with reasonable amounts and only run a limited number of transactions.

Still have questions?

If you can’t find an answer, contact our Support team