Braintree Auth (Beta)
Client-side Connect Flow
The following Connect flow will guide merchants through authorization in your Android mobile app without exposing your clientSecret
:
- The merchant taps the Connect with Braintree button in your app
- Your app sends the merchant to Braintree for authorization using an
Intent
and theconnect_url
supplied by your server. - Once the merchant has authorized, Braintree redirects them to the
redirect_uri
specified by theconnect_url
. - Your server performs the OAuth exchange.
- Your server redirects the merchant to a URL that is captured by an
IntentFilter
in your mobile app.
Button
- Download the connect-braintree-android assets.
- Add them to your project's
res
folder. - Display the Connect with Braintree button in an
ImageButton
or similar element in your view:
- 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 filters
Add the following to your app's manifest.xml
:
- 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>
Intent
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:
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 →