Generate a Client Token

A client token is a signed data blob that includes both configuration and authorization required by the Braintree Client SDK. Your server is responsible for generating a client token for use by your client. Client tokens should not be reused; a new one should be requested for each transaction. For security, we will revoke client tokens if they are reused excessively within a short time period.

To simply create a client token:

@client_token = Braintree::ClientToken.generate
Ruby

You will need to include a customer ID in your request if you’re using the Drop-In UI with an existing customer or if you are creating SEPA transactions:

@client_token = Braintree::ClientToken.generate(
  :customer_id => a_customer_id
)
Ruby

If the Braintree Client SDK succeeds with a payment method nonce, that nonce will then be linked with the identified customer. See Customer Management for details on customers. Payment method nonces expire after 24 hours.