Client-side Connect Flow
Availability
Braintree Auth is in closed beta. Contact us to express interest.
Add a Connect with Braintree button so a merchant can connect their Braintree account to your platform using Braintree Auth.
Prerequisites
Before you add the button, make sure you have:
-
The
connect_urlvalue your server generates with the Braintree server library'sconnect_urlmethod. See Server-side Connect Flow. - A container on your page for the button, such as a DOM element, a DOM element ID, or a jQuery selector.
Add the Connect with Braintree button
To make it easy to display the Connect with Braintree button, use the small
JavaScript library braintree-oauth-connect.js. Add this library to your page and pass in
the connect_url you generated on the server.
- HTML
Code snippet NOT FOUNDWhen the script runs successfully, the Connect with Braintree button appears inside the container element you specified.
The parameters available are:
| Parameter | Description |
|---|---|
connectUrl |
Required. The URL generated by the Braintree server library's connect_url
method.
|
container |
Required. The place on your page where the Connect with Braintree button
will live. This can be:
|
onError(function callback(error) {}) |
Optional. Takes a callback function to receive errors as an object with a
message property.
|
environment |
Optional. Accepts production (default if not provided) or
sandbox.
|