Braintree provides complementary client and server SDKs to complete your integration:

  • The client SDKs enable you to collect payment method (e.g. credit card, PayPal) details
  • The server SDKs manage all requests to the Braintree gateway

Before we get started, there are two key concepts to introduce: the client token and the payment method nonce.

Client token

A client token is a signed data blob that includes configuration and authorization information required by the Braintree client SDK. These should not be reused; a new client token should be generated for each request that's sent to Braintree. For security, we will revoke client tokens if they are reused excessively within a short time period.

Your server is responsible for generating the client token, which contains all of the necessary configuration information to set up the client SDKs. When your server provides a client token to your client, it authenticates the application to communicate directly to Braintree.

Your client is responsible for obtaining the client token from your server and initializing the client SDK. If this succeeds, the client will generate a payment method nonce.

Payment method nonce

The payment method nonce is a string returned by the client SDK to represent a payment method. This string is a reference to the customer payment method details that were provided in your payment form and should be sent to your server where it can be used with the server SDKs to create a new transaction request.


Payment method nonces expire after 3 hours.

Your server integration doesn't need to know the payment method type (e.g. credit card, PayPal account, Bitcoin) that is represented in the nonce. This means that your first integration should continue to work with few or no code changes when new payment method types are introduced.

How it works

Client and server payment token flow Diagram demonstrating the required interaction between the client, Braintree servers and your server.
  1. Your app or web front-end requests a client token from your server in order to initialize the client SDK
  2. Your server generates and sends a client token back to your client with the server SDK
  3. Once the client SDK is initialized and the customer has submitted payment information, the SDK communicates that information to Braintree, which returns a payment method nonce
  4. You then send the payment nonce to your server
  5. Your server code receives the payment method nonce from your client and then uses the server SDK to create a transaction or perform other Braintree functions detailed in the guides

See our example integrations for a working demonstration.

API keys

Get your sandbox or production API keys from the Control Panel to complete your integration. Once you're ready to go live, be sure to switch from your sandbox API keys to production.

Next: Set Up Your Client →

Still have questions?

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