Venmo

Client-Side Implementationanchor

important

The SSL certificates for all Braintree SDKs are set to expire by June 30, 2025. This will impact existing versions of the SDK in published versions of your app. To reduce the impact, upgrade the Android SDK to version 4.45.0+ or version 5.0.0+ for the new SSL certifications.

If you do not decommission your app versions that include the older SDK versions or force upgrade your app with the updated certificates by the expiration date, 100% of your customer traffic will fail.

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.

Get the SDKanchor

Add the following in your app-level build.gradle:

  1. Ruby
dependencies {
  implementation 'com.braintreepayments.api:venmo:4.39.0'
}

Invoking the Venmo flowanchor

Create a BraintreeClient with a ClientTokenProvider or Tokenization Key. Construct a VenmoClient, add a VenmoListener, and call tokenizeVenmoAccount to get a nonce that can be sent to your server:

  1. Java
  2. Kotlin
public class MyActivity extends AppCompatActivity implements VenmoListener {

  private BraintreeClient braintreeClient;
  private VenmoClient venmoClient;

  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    braintreeClient = new BraintreeClient(this, new ExampleClientTokenProvider());
    venmoClient = new VenmoClient(this, braintreeClient);
    dataCollector = new DataCollector(braintreeClient);
    venmoClient.setListener(this);
  }

  private void tokenizeVenmoAccount() {
    VenmoRequest request = new VenmoRequest(VenmoPaymentMethodUsage.MULTI_USE);
    request.setProfileId("your-profile-id");
    request.setShouldVault(false);

    venmoClient.tokenizeVenmoAccount(this, request)
  }

  @Override
  public void onVenmoSuccess(@NonNull VenmoAccountNonce venmoAccountNonce) {
    dataCollector.collectDeviceData(MyActivity.this, (deviceData, dataCollectorError) -> {
      // send venmoAccountNonce.getString() and deviceData to server
    });
  }

  @Override
  public void onVenmoFailure(@NonNull Exception error) {
    if (error instanceof UserCanceledException) {
      // user canceled
    } else {
      // handle error
    }
  }
}

Payment method usageanchor

You must specify how you will use the customer's Venmo account by passing the VenmoPaymentMethodUsage into your VenmoRequest:

  • MULTI_USE: Request authorization for future payments (vaulting allowed)
  • SINGLE_USE: Request authorization for a one-time payment (vaulting not allowed)

The payment method usage will affect the customer flow by:

  • Displaying different phrases to the customer on the transaction consent page (e.g. "Authorize Business Name to pay with Venmo" vs. "Authorize Business Name to pay with Venmo for future purchases" where Business Name is the business name submitted in the Venmo application form).
  • Not displaying a merchant connection on the Connected Businesses page in the Venmo app when the paymentMethodUsage property is SINGLE_USE.
  • Allowing customers to update their funding instrument on the Connected Businesses page in the Venmo app when the paymentMethodUsage property is MULTI_USE.
note

If VenmoPaymentMethodUsage is set to SINGLE_USE:

  • A validation error will be returned if attempting to vault via PaymentMethod.create or Customer.create.
  • The transaction will be processed normally but the nonce will not be vaulted if store-in-vault or store-in-vault-on-success is passed during transaction.sale.
  1. Kotlin
  2. Java
val request = VenmoRequest(VenmoPaymentMethodUsage.MULTI_USE)

    venmoClient.tokenizeVenmoAccount(this, request)

For improved security we strongly recommend merchants to use the App Links flow when integrating with Venmo. Customers who do not have the Venmo app installed, or if the Venmo app cannot be presented, will fallback to a web based Venmo flow. In the web based Venmo fallback customers will be presented the flow in their default browser and returned to the merchant app securely.

important

This feature is only available in iOS v6.13.0+ and Android v4.42.0+

  1. Kotlin
  2. Java
val request = VenmoRequest(VenmoPaymentMethodUsage.MULTI_USE) // or VenmoPaymentMethodUsage.SINGLE_USE
      request.fallbackToWeb = true

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.

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. Kotlin
  2. Java
dataCollector.collectDeviceData(this@MyActivity) { deviceData, dataCollectorError ->
  // send venmoAccountNonce.string and deviceData to 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.

Shipping and Billing Address collectionanchor

You can specify if you wish to receive a customer's Venmo shipping and billing address by passing the collectCustomerBillingAddress and collectCustomerShippingAddress flags into your VenmoRequest. When these flags are enabled, Venmo will collect the required addresses from the consumer and send them back in the reponse object.

  1. Java
  2. Kotlin
VenmoRequest request = new VenmoRequest(VenmoPaymentMethodUsage.MULTI_USE);
request.setProfileId("your-profile-id");
request.setCollectCustomerBillingAddress(true);
request.setCollectCustomerShippingAddress(true);

venmoClient.tokenizeVenmoAccount(this, request)
note

You will only be able to collect customer addresses if you have Enriched Customer Data (ECD) enabled in the Control Panel. Details about how to enable ECD can be found in this support article. A validation error will be returned if attempting to collect customer addresses without enabling ECD.

Once the tokenization call is successful, you will receive the shipping and billing address in the venmo account nonce.

  1. Java
  2. Kotlin
@Override
public void onVenmoSuccess(@NonNull VenmoAccountNonce venmoAccountNonce) {
  PostalAddress billingAddress = venmoAccountNonce.getBillingAddress();
  String streetAddress = billingAddress.getStreetAddress();
  String extendedAddress = billingAddress.getExtendedAddress();
  String locality = billingAddress.getLocality();
  String region = billingAddress.getRegion();
  String postalCode = billingAddress.getPostalCode();

  PostalAddress shippingAddress = venmoAccountNonce.getShippingAddress();
  // ...
}

Amounts and Line Itemsanchor

If you are making the tokenization call in the context of a purchase, you will need to pass the total amount of the transaction which will be displayed to the user on the Venmo paysheet. Additionally, you can also pass other transaction details that you would like to render to the user such as subtotal, discount, taxes, shipping amount and line items.

  1. Java
  2. Kotlin
VenmoRequest request = new VenmoRequest(VenmoPaymentMethodUsage.MULTI_USE);
  request.setProfileId("your-profile-id");
  request.setTotalAmount('10.00');
  // Set optional amounts & line items
  request.setSubTotalAmount('8.00');
  request.setTaxAmount('1.00');
  request.setDiscountAmount('1.00');
  request.setShippingAmount('2.00');

  ArrayList<VenmoLineItem> lineItems = new ArrayList<>();
  lineItems.add(new VenmoLineItem(VenmoLineItem.KIND_DEBIT, "item-name", 2, "5.00"));
  lineItems.add(new VenmoLineItem(VenmoLineItem.KIND_CREDIT, "credited-item-name", 1, "2.00"));
  request.setLineItems(lineItems);

  venmoClient.tokenizeVenmoAccount(this, request)
note

All amount and line-item fields are optional except for totalAmount, which is required in the context of purchase. If the tokenize call is for vaulting only, totalAmount can be omitted.

important

The following validations will be performed on the provided transaction details:

  • All amounts are expected to be in USD
  • All amounts must be non-negative
  • All amounts must be of string type and must contain either a whole number or a number with two decimal places
  • Line-item should have four properties: item name, quantity, unit amount and type
  • Line-item type must be either CREDIT or DEBIT
  • The amounts for all individual line items present must add up to the total amount, or sub-total when present
  • All individual amounts (discount, shipping, tax, sub-total) must add up to the total amount
  • The VenmoLineItem constructor takes in paramters in a specific order: type, name, quantity, unitAmount

Next Page: Server-side