Braintree's v.zero consists of complementary client and server SDKs:
- The iOS client SDK enables you to collect payment method (e.g. credit card, PayPal) details in your app
- 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.
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 customer 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 and initializing the client SDK. If this succeeds, the client will generate a
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.
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 v.zero integration should continue to work with few or no code changes when new payment method types are introduced.
- Your app or web front-end requests a client token from your server in order to initialize the iOS SDK
- Your server generates and sends a client token back to your client with the Ruby SDK
- Once the iOS SDK is initialized and the customer has submitted payment information, the SDK communicates that information to Braintree, which returns a payment method nonce
- You then send the payment nonce to your server
- Your server code receives the payment method nonce from your client and then uses the Ruby SDK to create a transaction or perform other Braintree functions detailed in the guides