Credit Cards
Testing and Go Live
The sandbox environment only accepts specific test credit card numbers. Use the credit card values below to trigger different responses from the gateway.
Valid card numbers
These credit card numbers will not trigger specific credit card errors.
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 verification
The following credit card numbers will simulate an unsuccessful card verification response.
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 indicators
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 information
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 live
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:
- 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 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.