Credit Cards

Testing and Go Liveanchor

The sandbox environment only accepts specific test credit card numbers. Use the credit card values below to trigger different responses from the gateway.

note

When testing card verifications and transactions, keep in mind:

  • Transaction success is determined by the test amount you use. For example, when testing decline scenarios.
  • Verification success is determined by the test card number you use. For example, when testing Vault and recurring billing scenarios.

Learn more about the difference between transactions and verifications.

Valid card numbersanchor

These credit card numbers will not trigger specific credit card errors.

note

Using these numbers does not necessarily mean that a transaction will be successful in the sandbox. Other values that impact transaction success include:

Test Value Card Type
378282246310005 American Express
371449635398431 American Express
36259600000004 Diners Club*
6011000991300009 Discover
3530111333300000 JCB
6304000000000000 Maestro
5555555555554444 Mastercard
2223000048400011 Mastercard
4111111111111111 Visa
4005519200000004 Visa
4009348888881881 Visa
4012000033330026 Visa
4012000077777777 Visa
4012888888881881 Visa
4217651111111119 Visa
4500600000000061 Visa
6243030000000001 UnionPay
6221261111117766 UnionPay
6223164991230014 UnionPay

*Diners Club cards are processed as Discover cards.

Card numbers for unsuccessful verificationanchor

The following credit card numbers will simulate an unsuccessful card verification response.

note

Verifying a card is different than creating a transaction. To trigger an unsuccessful transaction, adjust the amount of the transaction.

Test Value Card Type Verification Response
4000111111111115 Visa processor declined
5105105105105100 Mastercard processor declined
378734493671000 American Express processor declined
6011000990139424 Discover processor declined
38520000009814 Diners Club* processor declined
3566002020360505 JCB failed (3000)

*Diners Club cards are processed as Discover cards.

Card numbers with type indicatorsanchor

The following card numbers can be used to simulate various types of cards, such as [prepaid](/braintree/docs/reference/response/credit-card/ruby#prepaid], commercial, or healthcare. Using any of the card numbers below will force the corresponding card type indicator to return "Yes" and the others to return "No" or "Unknown":

Test Value Card Type Indicator Response
4500600000000061 prepaid = "Yes"
4012004338508385 prepaid = "Yes", debit = "Yes"
4009040000000009 commercial = "Yes"
4005519200000004 Durbin regulated = "Yes"
4012000033330026 healthcare = "Yes"
4012000033330125 debit = "Yes"
4012000033330224 payroll = "Yes"
4012000033330422 all values = "No"
4012000033330323 all values = "Unknown"

Card numbers with other informationanchor

Test Value Card Type Card Information
4012000033330620 Visa country of issuance = "USA"
4012000033330729 Visa country of issuance = "CAN"
4023490000000008 Visa country of issuance = "IRL"
4444333322221111 Visa country of issuance = "GBR"
5555444433331111 Mastercard country of issuance = "GBR"
374512431123241 Amex country of issuance = "GBR"
375529658790105 Amex country of issuance = "IRL"
5101108206957373 Mastercard country of issuance = "IRL"
4012000033330521 Visa issuing bank ="NETWORK ONLY"

Go liveanchor

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 useranchor

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 credentialsanchor

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 settingsanchor

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 configurationanchor

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

  1. Ruby
gateway = Braintree::Gateway.new(
  :environment => :production,
  :merchant_id => "use_your_merchant_id",
  :public_key => "use_your_public_key",
  :private_key => "use_your_private_key",
)

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.

Test transactions in productionanchor

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.

See also