To test recurring billing functionality in sandbox:

  1. Store a payment method in your sandbox using the test values below
  2. Create a plan
  3. Create a subscription

Test values

Valid nonces

Nonce Description
fake-valid-nonce A valid nonce that can be used to create a transaction
fake-valid-no-billing-address-nonce A valid nonce containing no billing address information
fake-valid-visa-nonce A nonce representing a valid Visa card request
fake-valid-amex-nonce A nonce representing a valid American Express card request
fake-valid-mastercard-nonce A nonce representing a valid Mastercard request
fake-valid-discover-nonce A nonce representing a valid Discover card request
fake-valid-jcb-nonce A nonce representing a valid JCB card request
fake-valid-maestro-nonce A nonce representing a valid Maestro card request
fake-valid-dinersclub-nonce A nonce representing a valid Diners Club card request
fake-valid-prepaid-nonce A nonce representing a valid prepaid card request
fake-valid-commercial-nonce A nonce representing a valid commercial card request
fake-valid-durbin-regulated-nonce A nonce representing a valid Durbin regulated card request
fake-valid-healthcare-nonce A nonce representing a valid healthcare card request
fake-valid-debit-nonce A nonce representing a valid debit card request
fake-valid-payroll-nonce A nonce representing a valid payroll card request

Valid nonces with card info

Nonce Description
fake-valid-no-indicators-nonce A nonce representing a request for a valid card with no indicators
fake-valid-unknown-indicators-nonce A nonce representing a request for a valid card with unknown indicators
fake-valid-country-of-issuance-usa-nonce A nonce representing a request for a valid card issued in the USA
fake-valid-country-of-issuance-cad-nonce A nonce representing a request for a valid card issued in Canada
fake-valid-issuing-bank-network-only-nonce A nonce representing a request for a valid card with the message 'Network Only' from the issuing bank

Alternate payment method nonces

Nonce Description
fake-android-pay-nonce A nonce representing an Android Pay request
fake-android-pay-visa-nonce A nonce representing an Android Pay Visa request
fake-android-pay-mastercard-nonce A nonce representing an Android Pay Mastercard request
fake-android-pay-amex-nonce A nonce representing an Android Pay American Express request
fake-android-pay-discover-nonce A nonce representing an Android Pay Discover request
fake-apple-pay-amex-nonce A nonce representing an Apple Pay request for an American Express card number
fake-apple-pay-visa-nonce A nonce representing an Apple Pay request for a Visa card number
fake-apple-pay-mastercard-nonce A nonce representing an Apple Pay request for a Mastercard card number
fake-apple-pay-discover-nonce A nonce representing an Apple Pay request for a Discover card number
fake-coinbase-nonce A nonce representing a Coinbase account
fake-paypal-one-time-nonce A nonce representing an unvaulted PayPal account that a user has authorized for the one time payment flow. Learn more about PayPal testing options.
fake-paypal-future-nonce A nonce representing a PayPal account that a user has authorized for the future payment flow. Learn more about PayPal testing options.
fake-visa-checkout-amex-nonce A nonce representing an American Express card from Visa Checkout
fake-visa-checkout-discover-nonce A nonce representing a Discover card from Visa Checkout
fake-visa-checkout-mastercard-nonce A nonce representing a Mastercard card from Visa Checkout
fake-visa-checkout-visa-nonce A nonce representing a Visa card from Visa Checkout

Invalid nonces

The following payment method nonces represent credit cards that simulate an unsuccessful card verification response. Verifying a payment method is different than creating a transaction, and these test nonces will not cause a transaction to fail. To trigger an unsuccessful transaction, adjust the amount of the transaction.

Processor rejected nonces

Nonce Description
fake-processor-declined-visa-nonce A nonce representing a request for a Visa card that was declined by the processor
fake-processor-declined-mastercard-nonce A nonce representing a request for a Mastercard that was declined by the processor
fake-processor-declined-amex-nonce A nonce representing a request for a American Express card that was declined by the processor
fake-processor-declined-discover-nonce A nonce representing a request for a Discover card that was declined by the processor
fake-processor-failure-jcb-nonce A nonce representing a request for a JCB card that was declined by the processor

Gateway rejected nonces

Nonce Description
fake-luhn-invalid-nonce A nonce representing a Luhn-invalid card
fake-consumed-nonce A nonce that has already been consumed
fake-gateway-rejected-fraud-nonce A nonce representing a card that will be gateway rejected due to fraud (only if you have any fraud rules enabled in sandbox)

When writing integrations tests against the Braintree sandbox environment, you may also use these nonce objects in place of the nonce that would normally be returned from the client side integration.

Ruby
Braintree::Test::Nonce::Transactable
Braintree::Test::Nonce::Consumed
Braintree::Test::Nonce::PayPalOneTimePayment
Braintree::Test::Nonce::PayPalFuturePayment

You can also use the test credit card values in the Testing Reference page.

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 recommend creating a new user specifically designated as the API user, whose API keys can be used for your integration. This user 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
Braintree::Configuration.environment = :production
Braintree::Configuration.merchant_id = "YOUR_PRODUCTION_MERCHANT_ID"
Braintree::Configuration.public_key = "YOUR_PRODUCTION_PUBLIC_KEY"
Braintree::Configuration.private_key = "YOUR_PRODUCTION_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.

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.

See also

Still have questions?

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