Client-side Connect Flow

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.

ButtonAnchorIcon

  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
No Text Found

Intent filtersAnchorIcon

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>

IntentAnchorIcon

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. Java
  2. Kotlin
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.