Braintree Auth (Beta)

Client-side Connect Flowanchor

availability

Braintree Auth is in closed beta. Contact us to express interest.

The following Connect flow will guide merchants through authorization in your Android mobile app without exposing your clientSecret:

  1. The merchant taps the Connect with Braintree button in your app
  2. Your app sends the merchant to Braintree for authorization using an Intent and the connect_url supplied by your server.
  3. Once the merchant has authorized, Braintree redirects them to the redirect_uri specified by the connect_url.
  4. Your server performs the OAuth exchange.
  5. Your server redirects the merchant to a URL that is captured by an IntentFilter in your mobile app.

Buttonanchor

  1. Download the connect-braintree-android assets.
  2. Add them to your project's res folder.
  3. Display the Connect with Braintree button in an ImageButton or similar element in your view:
  1. Swift
<ImageButton
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:src="@drawable/btn_bt_connect_normal"
  android:background="@android:color/transparent"
  android:id="@+id/connect"
  android:layout_marginTop="128dp" />

Intent filtersanchor

Add the following to your app's manifest.xml:

  1. Swift
<activity android:name="com.my.example.app.MyActivity" 
    android:launchMode="singleTask"
    android:exported="true">
    <intent-filter>
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />
        <data
          android:scheme="https://"
          android:host="example.com"
          android:path="/merchant-connected"
        />
    </intent-filter>
</activity>
note

Future versions of the Android SDK will require you to verify your app's Intent Filters.

Intentanchor

When a merchant taps the Connect button, your mobile app should send them to Braintree using an Intent and the connect_url from your server:

  1. Android
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(CONNECT_URL_FROM_SERVER));
startActivity(intent)

After authorizing, your server will redirect your merchant back to the /merchant-connected path, which will be picked up by your mobile app's IntentFilter and launch the activity that you configured in your app's manifest.xml earlier.


Next Page: OAuth Flow