Recurring Billing

Testing and Go Liveanchor

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 valuesanchor

Nonces representing cardsanchor

You can use any of the nonces in this table to simulate a card transaction or trigger a successful card verification response.

note

When testing card verifications and transactions, keep in mind:

  • Transaction success is determined by the test amount you use
  • Verification success is determined by the test nonce you use
NonceDescription
fake-valid-nonceA valid nonce that can be used to create a transaction
fake-valid-no-billing-address-nonceA valid nonce containing no billing address information
fake-valid-visa-nonceA nonce representing a valid Visa card request
fake-valid-amex-nonceA nonce representing a valid American Express card request
fake-valid-mastercard-nonceA nonce representing a valid Mastercard request
fake-valid-discover-nonceA nonce representing a valid Discover card request
fake-valid-jcb-nonceA nonce representing a valid JCB card request
fake-valid-maestro-nonceA nonce representing a valid Maestro card request
fake-valid-dinersclub-nonceA nonce representing a valid Diners Club card request
fake-valid-prepaid-nonceA nonce representing a valid prepaid card request
fake-valid-commercial-nonceA nonce representing a valid commercial card request
fake-valid-durbin-regulated-nonceA nonce representing a valid Durbin regulated card request
fake-valid-healthcare-nonceA nonce representing a valid healthcare card request
fake-valid-debit-nonceA nonce representing a valid debit card request
fake-valid-payroll-nonceA nonce representing a valid payroll card request
fake-valid-no-indicators-nonceA nonce representing a request for a valid card with no indicators
fake-valid-unknown-indicators-nonceA nonce representing a request for a valid card with unknown indicators
fake-valid-country-of-issuance-usa-nonceA nonce representing a request for a valid card issued in the USA
fake-valid-country-of-issuance-cad-nonceA nonce representing a request for a valid card issued in Canada
fake-valid-issuing-bank-network-only-nonceA nonce representing a request for a valid card with the message 'NETWORK ONLY' from the issuing bank

Nonces representing alternative payment methodsanchor

NonceDescription
fake-android-pay-nonceA nonce representing a Google Pay request
fake-android-pay-visa-nonceA nonce representing a Google Pay Visa request
fake-android-pay-visa-debit-nonceA nonce representing a Google Pay Visa debit request
fake-android-pay-mastercard-nonceA nonce representing a Google Pay Mastercard request
fake-android-pay-amex-nonceA nonce representing a Google Pay American Express request
fake-android-pay-discover-nonceA nonce representing a Google Pay Discover request
fake-google-pay-paypal-nonceA nonce representing a PayPal via Google Pay request
fake-apple-pay-amex-nonceA nonce representing an Apple Pay request for an American Express card number
fake-apple-pay-visa-nonceA nonce representing an Apple Pay request for a Visa card number
fake-apple-pay-visa-debit-nonceA nonce representing an Apple Pay request for a Visa debit card number
fake-apple-pay-mastercard-nonceA nonce representing an Apple Pay request for a Mastercard card number
fake-apple-pay-discover-nonceA nonce representing an Apple Pay request for a Discover card number
fake-local-payment-method-nonceA nonce representing a Local Payment Method
fake-paypal-one-time-nonceOnly valid when using the mocked PayPal testing strategy. A nonce representing an unvaulted PayPal account that a customer has authorized for one-time payments via the Checkout flow. Learn more about PayPal testing options.
fake-paypal-billing-agreement-nonceOnly valid when using the mocked PayPal testing strategy. A nonce representing a PayPal billing agreement that a customer has authorized via the Vault flow. Learn more about PayPal testing options.
fake-visa-checkout-amex-nonceA nonce representing an American Express card from Visa Checkout
fake-visa-checkout-discover-nonceA nonce representing a Discover card from Visa Checkout
fake-visa-checkout-mastercard-nonceA nonce representing a Mastercard card from Visa Checkout
fake-visa-checkout-visa-nonceA nonce representing a Visa card from Visa Checkout
fake-masterpass-amex-nonceA nonce representing an American Express card from Masterpass
fake-masterpass-discover-nonceA nonce representing a Discover card from Masterpass
fake-masterpass-mastercard-nonceA nonce representing a Mastercard card from Masterpass
fake-masterpass-visa-nonceA nonce representing a Visa card from Masterpass
fake-venmo-account-nonceA nonce representing a Venmo Account
tokensam_fake_visaA nonce representing a Visa card from Samsung Pay
tokensam_fake_mastercardA nonce representing a Mastercard card from Samsung Pay
tokensam_fake_american_expressA nonce representing an American Express card from Samsung Pay

Nonces for testing card verificationanchor

Processor rejected noncesanchor

The following payment method nonces represent credit cards that simulate an unsuccessful card verification response with a status of processor_declined.

NonceDescription
fake-processor-declined-visa-nonceA nonce representing a request for a Visa card that was declined by the processor
fake-processor-declined-mastercard-nonceA nonce representing a request for a Mastercard that was declined by the processor
fake-processor-declined-amex-nonceA nonce representing a request for a American Express card that was declined by the processor
fake-processor-declined-discover-nonceA nonce representing a request for a Discover card that was declined by the processor
fake-processor-declined-dinersclub-nonceA nonce representing a request for a Diners Club card that was declined by the processor
fake-processor-failure-jcb-nonceA nonce representing a request for a JCB card that was declined by the processor

Gateway rejected noncesanchor

The following payment method nonces represent credit cards that simulate an unsuccessful card verification response with a status of gateway_rejected.

NonceDescription
fake-luhn-invalid-nonceA nonce representing a Luhn-invalid card
fake-consumed-nonceA nonce that has already been consumed

CVV-only noncesanchor

The following payment method nonces represent credit card CVV or CID values collected on the client side to verify cards already stored in your Vault. The test nonce you use determines which cvv_response_code you receive in the sandbox.

NonceDescription
fake-three-digit-cvv-only-nonceA nonce representing a 3-digit CVV with a CVV response of M (matches)
fake-three-digit-cvv-only-n-response-nonceA nonce representing a 3-digit CVV with a CVV response of N (does not match)
fake-three-digit-cvv-only-u-response-nonceA nonce representing a 3-digit CVV with a CVV response of U (not verified)
fake-three-digit-cvv-only-s-response-nonceA nonce representing a 3-digit CVV with a CVV response of S (issuer does not participate)
fake-four-digit-cvv-only-nonceA nonce representing a 4-digit CID with a CVV response of M (matches)
fake-four-digit-cvv-only-n-response-nonceA nonce representing a 4-digit CID with a CVV response of N (does not match)
fake-four-digit-cvv-only-u-response-nonceA nonce representing a 4-digit CID with a CVV response of U (not verified)
fake-four-digit-cvv-only-s-response-nonceA nonce representing a 4-digit CID with a CVV response of S (issuer does not participate)

For details on generating CVV-only nonces in your client-side integration, see the client SDK references:

3D Secure nonces and authentication IDsanchor

You can use these nonces or authentication IDs to test your integration under various 3D Secure scenarios for Visa cards. Authentication IDs are an alternate way of specifying a 3D Secure authentication to use for a transaction if no authentication is attached to the payment method. See the 3D Secure guide for more information on different status codes.

note

The following nonces are only for testing Visa cards. Liability shift status is generally agnostic to the card type and other card brands will work similarly.

NonceAuthentication IDDescriptionStatus
fake-three-d-secure-visa-full-authentication-noncefake-three-d-secure-visa-full-authentication-idA nonce or three_d_secure_authentication_id representing a full 3D Secure authentication"authenticate_successful"
fake-three-d-secure-visa-lookup-timeout-noncefake-three-d-secure-visa-lookup-timeout-idA nonce or three_d_secure_authentication_id representing a 3D secure error where the cardholder enrollment lookup request timed out"lookup_error"
fake-three-d-secure-visa-failed-authentication-noncefake-three-d-secure-visa-failed-authentication-idA nonce or three_d_secure_authentication_id representing a 3D Secure scenario where the cardholder was enrolled but failed authentication"authenticate_failed"
fake-three-d-secure-visa-attempts-non-participating-noncefake-three-d-secure-visa-attempts-non-participating-idA nonce or three_d_secure_authentication_id representing a 3D Secure authentication through the card brand's Attempts server because the issuer's authentication server is unavailable"authenticate_attempt_successful"
fake-three-d-secure-visa-not-enrolled-noncefake-three-d-secure-visa-not-enrolled-idA nonce or three_d_secure_authentication_id representing a 3D Secure authentication where the cardholder was not enrolled"lookup_not_enrolled"
fake-three-d-secure-visa-unavailable-noncefake-three-d-secure-visa-unavailable-idA nonce or three_d_secure_authentication_id representing a 3D Secure error where enrollment lookup is not available"authentication_unavailable"
fake-three-d-secure-visa-mpi-lookup-error-noncefake-three-d-secure-visa-mpi-lookup-error-idA nonce or three_d_secure_authentication_id representing a 3D Secure error during the cardholder enrollment lookup"authentication_unavailable"
fake-three-d-secure-visa-mpi-authenticate-error-noncefake-three-d-secure-visa-mpi-authenticate-error-idA nonce or three_d_secure_authentication_id representing a 3D Secure error during authentication"authenticate_error"
fake-three-d-secure-visa-authentication-unavailable-noncefake-three-d-secure-visa-authentication-unavailable-idA nonce or three_d_secure_authentication_id representing a 3D Secure error where the cardholder is enrolled but authentication is not available"authenticate_unable_to_authenticate"
fake-three-d-secure-visa-bypassed-authentication-noncefake-three-d-secure-visa-bypassed-authentication-idA nonce or three_d_secure_authentication_id representing a scenario where 3D Secure must be bypassed to prevent rejections during lookup or authentication service outages"lookup_bypassed"
fake-three-d-secure-two-visa-successful-frictionless-authentication-noncefake-three-d-secure-two-visa-successful-frictionless-authentication-idA nonce or three_d_secure_authentication_id representing a 3D Secure 2 successful authentication that did not require a challenge"authenticate_successful"
fake-three-d-secure-two-visa-successful-step-up-authentication-noncefake-three-d-secure-two-visa-successful-step-up-authentication-idA nonce or three_d_secure_authentication_id representing a 3D Secure 2 successful authentication that required a challenge"authenticate_successful"
fake-three-d-secure-two-visa-error-on-lookup-noncefake-three-d-secure-two-visa-error-on-lookup-idA nonce or three_d_secure_authentication_id representing a 3D Secure 2 error during the cardholder enrollment lookup"lookup_error"
fake-three-d-secure-two-visa-timeout-on-lookup-noncefake-three-d-secure-two-visa-timeout-on-lookup-nonceA nonce or three_d_secure_authentication_id representing a 3D secure 2 error where the cardholder enrollment lookup request timed out"lookup_error"

Nonce objectsanchor

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.

  1. 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 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