Braintree/src/main/java/com/braintreepayments/api/Venmo.java
public static void authorizeAccount(final BraintreeFragment fragment, final boolean vault, final String profileId) {
        fragment.waitForConfiguration(new ConfigurationListener() {
            @Override
            public void onConfigurationFetched(Configuration configuration) {
                fragment.sendAnalyticsEvent("pay-with-venmo.selected");

                String venmoProfileId = profileId;
                if (TextUtils.isEmpty(venmoProfileId)) {
                    venmoProfileId = configuration.getPayWithVenmo().getMerchantId();
                }

                String exceptionMessage = "";
                if (!configuration.getPayWithVenmo().isAccessTokenValid()) {
                    exceptionMessage = "Venmo is not enabled";
                } else if (!Venmo.isVenmoInstalled(fragment.getApplicationContext())) {
                    exceptionMessage = "Venmo is not installed";
                }

                if (!TextUtils.isEmpty(exceptionMessage)) {
                    fragment.postCallback(new AppSwitchNotAvailableException(exceptionMessage));
                    fragment.sendAnalyticsEvent("pay-with-venmo.app-switch.failed");
                } else {
                    persistVenmoVaultOption(vault && fragment.getAuthorization() instanceof ClientToken,
                            fragment.getApplicationContext());

                    fragment.startActivityForResult(getLaunchIntent(configuration.getPayWithVenmo(), venmoProfileId, fragment),
                            BraintreeRequestCodes.VENMO);
                    fragment.sendAnalyticsEvent("pay-with-venmo.app-switch.started");
                }
            }
        });
    }
public static void authorizeAccount(final BraintreeFragment fragment, final boolean vault, final String profileId) {
        fragment.waitForConfiguration(new ConfigurationListener() {
            @Override
            public void onConfigurationFetched(Configuration configuration) {
                fragment.sendAnalyticsEvent("pay-with-venmo.selected");

                String venmoProfileId = profileId;
                if (TextUtils.isEmpty(venmoProfileId)) {
                    venmoProfileId = configuration.getPayWithVenmo().getMerchantId();
                }

                String exceptionMessage = "";
                if (!configuration.getPayWithVenmo().isAccessTokenValid()) {
                    exceptionMessage = "Venmo is not enabled";
                } else if (!Venmo.isVenmoInstalled(fragment.getApplicationContext())) {
                    exceptionMessage = "Venmo is not installed";
                }

                if (!TextUtils.isEmpty(exceptionMessage)) {
                    fragment.postCallback(new AppSwitchNotAvailableException(exceptionMessage));
                    fragment.sendAnalyticsEvent("pay-with-venmo.app-switch.failed");
                } else {
                    persistVenmoVaultOption(vault && fragment.getAuthorization() instanceof ClientToken,
                            fragment.getApplicationContext());

                    fragment.startActivityForResult(getLaunchIntent(configuration.getPayWithVenmo(), venmoProfileId, fragment),
                            BraintreeRequestCodes.VENMO);
                    fragment.sendAnalyticsEvent("pay-with-venmo.app-switch.started");
                }
            }
        });
    }
public static void authorizeAccount ( final BraintreeFragment fragment , final boolean vault , final String profileId ) { fragment . waitForConfiguration ( new ConfigurationListener ( ) { @ Override public void onConfigurationFetched ( Configuration configuration ) { fragment . sendAnalyticsEvent ( "pay-with-venmo.selected" ) ; String venmoProfileId = profileId ; if ( TextUtils . isEmpty ( venmoProfileId ) ) { venmoProfileId = configuration . getPayWithVenmo ( ) . getMerchantId ( ) ; } String exceptionMessage = "" ; if ( ! configuration . getPayWithVenmo ( ) . isAccessTokenValid ( ) ) { exceptionMessage = "Venmo is not enabled" ; } else if ( ! Venmo . isVenmoInstalled ( fragment . getApplicationContext ( ) ) ) { exceptionMessage = "Venmo is not installed" ; } if ( ! TextUtils . isEmpty ( exceptionMessage ) ) { fragment . postCallback ( new AppSwitchNotAvailableException ( exceptionMessage ) ) ; fragment . sendAnalyticsEvent ( "pay-with-venmo.app-switch.failed" ) ; } else { persistVenmoVaultOption ( vault && fragment . getAuthorization ( ) instanceof ClientToken , fragment . getApplicationContext ( ) ) ; fragment . startActivityForResult ( getLaunchIntent ( configuration . getPayWithVenmo ( ) , venmoProfileId , fragment ) , BraintreeRequestCodes . VENMO ) ; fragment . sendAnalyticsEvent ( "pay-with-venmo.app-switch.started" ) ; } } } ) ; }
Start the Pay With Venmo flow. This will app switch to the Venmo app.
<p/>
If the Venmo app is not available, {@link AppSwitchNotAvailableException} will be sent to {@link
com.braintreepayments.api.interfaces.BraintreeErrorListener#onError(Exception)}.

@param fragment {@link BraintreeFragment}
@param vault If true, and you are using Client Token authorization with a customer ID, this payment method will
be added to your customer's vault. @see <a href="https://developers.braintreepayments.com/guides/authorization/overview">our
docs on client authorization</a> for more info.
@param profileId The Venmo profile ID to be used during payment authorization. Customers will see the business
name and logo associated with this Venmo profile, and it will show up in the Venmo app as a "Connected Merchant".
Venmo profile IDs can be found in the Braintree Control Panel. Passing `null` will use the default Venmo profile.
Start the Pay With Venmo flow . This will app switch to the Venmo app . <p / > If the Venmo app is not available { @link AppSwitchNotAvailableException } will be sent to { @link com . braintreepayments . api . interfaces . BraintreeErrorListener#onError ( Exception ) } .