Venmo

Client-Side Implementation

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 iOS SDK to version 6.17.0+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 methodAnchorIcon

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

Drop-in integrationAnchorIcon

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 integrationAnchorIcon

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 SDKAnchorIcon

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

  1. Kotlin
  2. Groovy
dependencies {
    implementation("com.braintreepayments.api:venmo:5.8.0")
}

Invoking the Venmo flowAnchorIcon

Create an instance of VenmoClient and VenmoLauncher. When ready to launch the Venmo flow, make a call to venmoClient.createPaymentAuthRequest() - see startVenmoFlow() for an example in the code sample below. Store the VenmoPendingRequest obtained from a call to venmoLauncher.launch() to use later. In your onResume() method, call venmoLauncher.handleReturnToApp(). Once you have a successful result, complete the Venmo flow by calling venmoClient.tokenize(). See individual methods for detailed docs.

  1. Kotlin
class VenmoActivity : AppCompatActivity() {
    private lateinit var venmoClient: VenmoClient
    private lateinit var venmoLauncher: VenmoLauncher

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

        // must be initialized on onCreate()
        venmoLauncher = VenmoLauncher()

        // can be initialized outside onCreate() if desired
        venmoClient = VenmoClient(
            context = requireContext(),
            authorization = "TOKENIZATION_KEY or CLIENT_TOKEN",
            appLinkReturnUrl = Uri.parse("https://merchant-app.com") // Merchant App Link
        )
    }

    // ONLY REQUIRED IF YOUR ACTIVITY LAUNCH MODE IS SINGLE_TOP
    override fun onNewIntent(intent: Intent) {
        super.onNewIntent(intent)
        handleReturnToApp(intent)
    }

    // ALL OTHER ACTIVITY LAUNCH MODES
    override fun onResume() {
        super.onResume()
        handleReturnToApp(intent)
    }

    private fun handleReturnToApp(intent: Intent) {
        super.onResume()
        val pendingRequest: VenmoPendingRequest.Started = pendingRequest
        pendingRequest?.let {
            val paymentAuthResult: VenmoPaymentAuthResult =
                venmoLauncher.handleReturnToApp(
                    pendingRequest = it,
                    intent = intent
                )
            if (paymentAuthResult is VenmoPaymentAuthResult.Success) {
                // complete the venmo flow with the successful paymentAuthResult
                completeVenmoFlow(paymentAuthResult)
            } else {
                // handle error - user did not complete Venmo flow
            }
            // clear pendingRequest
        }
    }

    private fun startVenmoFlow(venmoRequest: VenmoRequest) {
        venmoClient.createPaymentAuthRequest(
            context = requireActivity(),
            request = venmoRequest
        ) { paymentAuthRequest ->
            if (paymentAuthRequest is VenmoPaymentAuthRequest.Failure) {
                // handle paymentAuthRequest.error
            } else if (paymentAuthRequest is VenmoPaymentAuthRequest.ReadyToLaunch) {
                val pendingRequest: VenmoPendingRequest = venmoLauncher.launch(
                    activity = requireActivity(),
                    paymentAuthRequest = paymentAuthRequest
                )
                if (pendingRequest is VenmoPendingRequest.Started) {
                    // store pendingRequest for future use
                } else if (pendingRequest is VenmoPendingRequest.Failure) {
                    // handle pendingRequest.error
                }
            }
        }
    }

    private fun completeVenmoFlow(paymentAuthResult: VenmoPaymentAuthResult.Success) {
        venmoClient.tokenize(paymentAuthResult) { result: VenmoResult ->
            this.handleVenmoResult(result)
        }
    }

    private fun handleVenmoResult(result: VenmoResult) {
        when (result) {
            is VenmoResult.Success -> { /* handle result.nonce) */ }
            is VenmoResult.Failure -> { /* handle result.error */ }
            is VenmoResult.Cancel -> { /* handle user canceled */ }
        }
    }

    private fun storePendingRequest(request: VenmoPendingRequest.Started) {
        // store pending request
    }

    private val pendingRequest: VenmoPendingRequest.Started
        get() = { /* fetch stored pending request */ }

    private fun clearPendingRequest() {
        // clear/reset pending request
    }
}
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 profilesAnchorIcon

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 dataAnchorIcon

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

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.

If you accept cookies, we’ll use them to improve and customize your experience and enable our partners to show you personalized PayPal ads when you visit other sites. Manage cookies and learn more