important

Pay with Venmo requires version 4.29.0 and higher of the iOS SDK.

Set up your iOS client

If you are using CocoaPods to integrate the Braintree iOS v4 SDK, add the Venmo subspec to your Podfile:

Ruby
# Podfile
pod 'Braintree'
pod 'Braintree/Venmo'

Whitelist Venmo URL scheme

You must add the following to the queries schemes whitelist in your app's info.plist:

XML
<key>LSApplicationQueriesSchemes</key>
<array>
  <string>com.venmo.touch.v2</string>
</array>

Include the app display name

You must have a display name in your app's info.plist to help Venmo identify your application:

XML
<key>CFBundleDisplayName</key>
<string>Your App Name</string>

Setup for app switch

To handle workflows that involve switching to another app or SFSafariViewController for authentication, you must register a URL type and configure your app to handle return URLs.

Register a URL type

  1. In Xcode, click on your project in the Project Navigator and navigate to App Target > Info > URL Types
  2. Click [+] to add a new URL type
  3. Under URL Schemes, enter your app switch return URL scheme. This scheme must start with your app's Bundle ID and be dedicated to Braintree app switch returns. For example, if the app bundle ID is com.your-company.Your-App, then your URL scheme could be com.your-company.Your-App.payments.
important

If you have multiple app targets, be sure to add the return URL type for all of the targets.

Testing the URL type

You can test out your new URL scheme by opening up a URL that starts with it (e.g. com.your-company.Your-App.payments://test) in Mobile Safari on your iOS Device or Simulator.

In addition, always test your app switching on a real device.

Update your application delegate

In your AppDelegate's application:didFinishLaunchingWithOptions: implementation, use setReturnURLScheme: with the value you set above.

For example:

#import "AppDelegate.h"
#import "BraintreeCore.h"

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    [BTAppSwitch setReturnURLScheme:@"com.your-company.Your-App.payments"];
    return YES;
}

Then in your application delegate, pass the payment authorization URL to Braintree for finalization:

- (BOOL)application:(UIApplication *)application
            openURL:(NSURL *)url
            options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
    if ([url.scheme localizedCaseInsensitiveCompare:@"com.your-company.Your-App.payments"] == NSOrderedSame) {
        return [BTAppSwitch handleOpenURL:url options:options];
    }
    return NO;
}

// If you support iOS 8, add the following method.
- (BOOL)application:(UIApplication *)application
            openURL:(NSURL *)url
  sourceApplication:(NSString *)sourceApplication
         annotation:(id)annotation {
    if ([url.scheme localizedCaseInsensitiveCompare:@"com.your-company.Your-App.payments"] == NSOrderedSame) {
        return [BTAppSwitch handleOpenURL:url sourceApplication:sourceApplication];
    }
    return NO;
}

Choose an integration method

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

Drop-in integration

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

Enable Venmo for Drop-in

If you are using CocoaPods to integrate Drop-in, first add the Venmo subspec to your Podfile:

Ruby
# Podfile
pod 'BraintreeDropIn'
pod 'Braintree/Venmo'

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

Handling the response

To handle the successful Venmo payment, cast the BTPaymentMethodNonce to a BTVenmoAccountNonce to access the username property that you receive from the BTDropInResult.

Custom integration

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.

#import "BraintreeVenmo.h"

@interface ViewController ()
@property (nonatomic, strong) BTVenmoDriver *venmoDriver;
@property (nonatomic, strong) UIButton *venmoButton;
@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    self.venmoDriver = [[BTVenmoDriver alloc] initWithAPIClient:self.apiClient];
    self.venmoButton.hidden = ![self.venmoDriver isiOSAppAvailableForAppSwitch];
}

- (void)tappedButton {
    // To vault the Venmo account, change this to YES and use a Braintree client token with a customer ID
    [self.venmoDriver authorizeAccountAndVault:NO WithCompletion:^(BTVenmoAccountNonce * _Nullable venmoAccount, NSError * _Nullable error) {
        if (venmoAccount) {
            // You got a Venmo nonce!
            NSLog(@"%@", venmoAccount.nonce);
        }
    }];
}
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.

Multiple profiles

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.

[self.venmoDriver authorizeAccountWithProfileID:@"YOUR_VENMO_PROFILE_ID" vault:NO completion:^(BTVenmoAccountNonce * _Nullable venmoAccount, NSError * _Nullable error) {
    // ...
}];
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 data

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

#import "PPDataCollector.h"
NSString *deviceData = [PPDataCollector collectPayPalDeviceData];

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 →