Venmo

Client-Side Implementationanchor

Choose an integration methodanchor

You can set up your client-side either with our Drop-in UI or with a custom integration.

Drop-in integrationanchor

important

To support Pay with Venmo on modern Android devices, we always recommend using the latest version of the Android Drop-in SDK. If you are unable to upgrade from your major version at this time, Pay with Venmo requires at least version 6.0.0-beta2 of major version 6, version 5.3.0 of major version 5, and version 4.7.0 of major version 4.

Our Drop-in UI is the fastest way to set up your client-side integration.

For full details, see Drop-in Setup and Integration.

Custom integrationanchor

important

To support Pay with Venmo on modern Android devices, we always recommend using the latest version of the Android SDK. If you are unable to upgrade from your major version at this time, Pay with Venmo requires at least version 4.6.0 of major version 4 and version 3.18.0 of major version 3.

Alternatively, you can add Venmo to your current custom integration. Keep in mind, for compliance purposes, we require you to present the customer with an order summary before and after purchase.

The pre-purchase summary should include:

  • The items ordered
  • The total order price
  • An indication of Venmo as the payment method

The post-purchase summary can either be shown in the UI or sent via email. It should include:

  • The items purchased
  • The total purchase price
  • The customer's name
  • The customer's Venmo username

Failing to comply with these guidelines can lead to an interruption of your Venmo service.

note

Click here to download Venmo's brand guidelines, and be sure to follow them when configuring the Venmo button or making any other references to Venmo in your app.

Begin by checking that Venmo is currently available for your app and your user. Implement a ConfigurationListener to get a configuration instance that can be used to check on Venmo availability.

  1. Android
@Override
public void onConfigurationFetched(Configuration configuration) {
  boolean venmoReady = configuration.getPayWithVenmo().isEnabled(context);
  showVenmoButton(venmoReady);
}

If your app is venmoReady, start the Venmo payment flow with the following:

  1. Android
@Override
public void onClick(View v) {
  // To vault the Venmo account, change this to true and use a Braintree client token with a customer ID
  Venmo.authorizeAccount(mBraintreeFragment, false);
}

Handling a successful responseanchor

Use a PaymentMethodNonceCreatedListener attached to BraintreeFragment to get a paymentMethodNonce if the Venmo flow is successful.

Verify that the PaymentMethodNonce returned is a VenmoAccountNonce. Then, you can access Venmo properties, such as the Venmo username.

note

It's best practice to display the customer's Venmo username alongside their Venmo payment method in your checkout UI – like you would the last 4 digits of a credit card number.

  1. Android
@Override
public void onPaymentMethodNonceCreated(PaymentMethodNonce paymentMethodNonce) {
  String nonce = paymentMethodNonce.getNonce();

  if (paymentMethodNonce instanceof VenmoAccountNonce) {
    VenmoAccountNonce venmoAccountNonce = (VenmoAccountNonce) paymentMethodNonce;
    String venmoUsername = venmoAccountNonce.getUsername();
  }
}

Handling cancel and error responsesanchor

Attaching a BraintreeErrorListener to BraintreeFragment allows your app to view any error responses coming back from BraintreeFragment.

This is the most common error in the Venmo flow:

  1. Android
@Override
public void onError(Exception error) {
  if (error instanceof AppSwitchNotAvailableException) {
    // Braintree is unable to switch to the Venmo app.
    // Append this to your log for troubleshooting.
    String developerReadableMessage = error.getMessage();
  }
}

Similarly, attaching a BraintreeCancelListener to BraintreeFragment allows your app to view any canceled activity responses from BraintreeFragment.

  1. Android
@Override
public void onCancel(int requestCode) {
  if (requestCode == Venmo.VENMO_REQUEST_CODE) {
    // Venmo request was canceled by the user, or the user pressed back.
  }
}

Multiple profilesanchor

If you have a custom integration and have onboarded multiple apps for Venmo processing with a single Braintree gateway, you'll need to pass the profile_id to specify which Venmo profile to present during the payment flow.

You'll also need to pass the profile_id when creating the transaction on the server side.

  1. Android
Venmo.authorizeAccount(fragment, false, YOUR_VENMO_PROFILE_ID);
note

If you have multiple business profiles, the profile_id for each profile can be found by logging into the Control Panel, clicking the gear icon in the top right corner, selecting Processing from the drop-down menu, scrolling to Venmo, and clicking the Options link.

Collect device dataanchor

You must collect information about the customer's device before creating each transaction.

  1. Android
DataCollector.collectDeviceData(braintreeFragment, new BraintreeResponseListener<String> {
  @Override
  public void onResponse(String deviceData) {
    // send deviceData to your server
  }
});

You'll need to pass this deviceData when creating the Venmo transaction from your server.

important

Be sure to pass device data as close to the transaction creation as possible. Doing so will help reduce decline rates.


Next Page: Server-side