Stripe or Braintree: Tech differences and implementation

While there are multiple solutions for processing payments via mobile apps, Stripe and Braintree (owned by PayPal) stand out as the most efficient payment systems. We decided to compare these two tech-driven platforms so that our clients have an easier job choosing the best payment system for their app’s needs.

Braintree and Stripe both have SDKs for iOS, Android, and JavaScript as well as server-side SDKs. We examined their documentation, ease of set-up, features, and anti-fraud tools. So let’s start digging in!

Whose documentation looks better?

Stripe has well-organized and comprehensive documentation with lots of examples for popular platforms including Ruby, Python, PHP, Java, Node.js, Go, and .NET. Each guide is cross-linked with related articles, so navigating is pretty simple. Most of the guides are broken down into steps so you can easily integrate each section of code in your app.

Stripe's documentation

[Stripe's documentation]

Braintree also has informative documentation with almost the same list of examples as Stripe (except it doesn’t support Go). Braintree also uses cross-links for related guides.

Both Stripe and Braintree offer wonderful documentation with examples that cover every possible request. This documentation allows developers to integrate the payment systems step by step, reading only necessary information and skipping what they don’t need.

Braintree's documentation

[Braintree's documentation]

How do payments work?

Each of these payment systems provides you with a server SDK that you need for sending money through its system.

To make payments on the client side, Braintree generates a token using the Braintree Server SDK. A token is an object that stores configuration settings and authorization needed for the Braintree Client SDK. In the client’s code, the token looks like a line that represents a JSON model encrypted with the help of Base64. 

The token that the client receives is used to work with the Braintree Client SDK. This SDK connects with the Braintree server and receives a payment method nonce, a string which describes the payment method the user has chosen (credit card, PayPal, etc.). This string is then sent to your server. On your server, the Braintree Server SDK carries out payment operations using the payment method nonce.

Payment process with Braintree

[Payment process on Braintree]

With Stripe, a token is generated on the client side with the help of the Stripe server and then sent to your server. This token is just an object and not an encrypted line like in Braintree. So Stripe lets you decide in what form you would like to send the token to the server, either as is or with your own encryption. On the one hand, your own encryption will provide better security when communicating with the server. But still, encryption is not a must.

Stripe warns in their documentation that you need to use an SSL connection on your server, without which you won’t be able to interact with the Stripe server, as they use an HSTS protection mechanism. You can read more about Stripe security here. After your server gets the token, you can process payments using the Stripe Server SDK.

Let’s have some code!

We want to show you how to do a simple integration of online payments into your web application. To make a fully working solution, we need to set up both frontend and backend parts.

Braintree integration

For the backend, we’ll give an example in Ruby for simplicity. First of all, you need to add the Braintree gem to your project’s Gemfile:

gem "braintree"

Next, you need to initialize the Braintree gateway and generate a client token for the frontend:

gateway =
  :environment => :sandbox,
  :merchant_id => "use_your_merchant_id",
  :public_key => "use_your_public_key",
  :private_key => "use_your_private_key",
@client_token = gateway.client_token.generate

On the frontend, you can use Braintree’s Drop-in UI library, so your HTML code should look like this:

  <script src=""></script>
  <div id="dropin-container"></div>
  <button id="submit-button">Request payment method</button>
    var button = document.querySelector('#submit-button');
      authorization: 'CLIENT_TOKEN_FROM_SERVER',
      container: '#dropin-container'
    }, function (createErr, instance) {
      button.addEventListener('click', function () {
        instance.requestPaymentMethod(function (err, payload) {
          // Submit payload.nonce to your server

When the browser loads this page, a user will see the form where credit card information should be entered (card number, expiration date, and CVV code).

Braintree payment form

[Braintree credit card form]

After a user provides their payment details and pushes the Purchase button, your application will get a payment nonce, which will be sent to the backend. Then you can use the client token to create a transaction:

post "/checkout" do
  nonce_from_the_client = params[:payment_method_nonce]
    amount: "9.99",
    payment_method_nonce: nonce_from_the_client,
    options: { submit_for_settlement: true }

That’s all for Braintree.

Stripe integration

Stripe integration looks a bit different. To set up Stripe on your backend, you just need to add the corresponding gem to your application’s Gemfile:

gem 'stripe'

Stripe offers multiple JavaScript libraries for the frontend. Let’s choose a simple one — Checkout.js.
In this case, your HTML code should look like this:

  <form action="/checkout" method="POST">
    <script src="" class="stripe-button"
      data-name="Application Name"

When the browser renders a page with the button Pay with Card, the user can click this button and then fill out a form that consists of fields for an email address, credit card number, expiration date, and CVV code. The form offers to save this payment information for future transactions.

Stripe payment form

[Stripe credit card form]

After a user fills out the form with payment details and taps the Pay button, your application will send data to Stripe and get back a Stripe token, which will be sent to your server. You can use this token to charge the customer:

post "/checkout" do
  Stripe.api_key = "sk_test_StripeSecretKey"
  token = params[:stripeToken]

  charge = Stripe::Charge.create({
    amount: 999,
    currency: 'usd',
    description: 'Example charge',
    source: token,

Voila! The customer has been charged.

Testing and test data

Braintree provides a Sandbox, which is a copy of the production panel for managing a Braintree account. You can get testing values of the API keys you need to set up client and server SDKs. As soon as you set up your product to work with Braintree, you can create a production account and copy API keys to replace the testing keys. You can see how to do this Braintree's developers page.

So you have two separate accounts, one for Sandbox and one for Production. On the one hand, the Sandbox allows you to make as many mistakes as it takes until you create a sustainable project. But on the other hand, if you have a lot of settings for discounts, subscriptions, additions, and other Braintree features, you’ll have to configure that all over again in the Production account.

Production account in Braintree

[Control panel in Braintree]

Braintree provides a manual about which testing cards and data you can use in the Sandbox.
For Stripe, you use the same account for testing and production. Stripe has a single site with a control panel that indicates if you’re in testing mode. Just as Braintree does, Stripe offers test API keys for testing purposes. In order to get into production, you simply need to turn the switch, activate your account, and change your application API keys to production keys. Stripe also gives testing instructions.

Testing data in Stripe

[Control panel in Stripe]


Basic functionality for processing payments is the same for both services. Alongside regular checkouts, they provide recurring payments with possibilities for discounts, add-ons, and so on. Stripe also offers a marketplace solution. Braintree used to provide the Braintree Marketplace product, but now it doesn’t allow new merchants to register. So if your business model includes marketplace payments, it’s better to consider Stripe as your payment provider. 

Check out the list of features for Braintree and Stripe.

Supported payment methods

Each payment gateway offers a different set of payment options. Some of these options are provided by both platforms and some are unique. For example, Braintree supports payments via PayPal (it’s owned by PayPal, after all) and Venmo, which is also owned by PayPal.

So if your users have either PayPal or Venmo, they won’t have to enter their credit card data in your app. If your users don’t have a Venmo account, they won’t have the option to pay using Venmo. However, the Pay with PayPal button will lead a user to the PayPal website to log in to their account if they don’t have the PayPal app installed.

On the other hand, Stripe offers Alipay and WeChat payments, which will be very helpful if your business is aimed at the Asian or global market. Here’s a list of supported payment methods.

List of supported payment methods

[Which payment methods Stripe and Braintree support — comparison]

Braintree also has a One Touch feature. The idea is to let users pay instantly in an app by redirecting them to the PayPal or Venmo app on their device.

Stripe has rolled out innovative capabilities such as issuing physical and virtual cards and using terminals to extend your online presence into the physical world. Both of these features allow for new business models.


Both payment services provide handy dashboards with plenty of instruments for configuring payment options, security settings, billing management, customer preferences and behavior, and so on. 

Braintree's dashboard

[Braintree's dashboard]

Stripe's dashboard

[Dashboard in Stripe]

Anti-fraud tools

Braintree is great at security. They’ve created a safe SDK that uses a token encrypted using Base64. This Base64-encoded token is generated on the server without storing any key on the client side. Braintree has also partnered with Kount to provide more security measures for server and client-side data. To access features that this partnership provides, you can simply integrate a code snippet. 

Stripe also helps you avoid fraud. Their new product, Radar, is a machine learning program to detect and fight fraud. Stripe and Braintree compete on the level of security they provide. But we would need a separate article in order to fully discuss security

With Braintree, you can add additional settings to CVV validation to prevent fraud:

  • Provided CVV does not match

  • CVV not provided

  • Provided CVV is not verified

  • The card issuer does not participate in card verification

Stripe’s Radar offers even more checking rules.

Radar's rules and regulations

[Radar's checking rules]

Read also: Core Elements of Data Security


When we compare Stripe vs Braintree, it becomes clear that the choice between them should not be based on ratings. Both payment providers offer a huge number of features and both work hard to get even more for their clients. So your choice of payment technology should be based on your business model and business requirements. If you’re interested in innovation and adding new features to your payment system, Stripe is the best solution for you. But if your business needs stability and gradual development and a provider that has a large and reputable brand behind it, then Braintree is more suitable for you.

You can check out the Braintree and Stripe support pages for detailed information on the basics of processing payments.

If you need some additional advice about which system to choose to enable payments in your mobile application or web application, we’ll be glad to help you figure it out!
Follow us on GitHub.

4.0/ 5.0
Article rating
Remember those Facebook reactions? Well, we aren't Facebook but we love reactions too. They can give us valuable insights on how to improve what we're doing. Would you tell us how you feel about this article?
See what else we can do

Check out our knowledge and capabilities

Contact us

We use cookies to personalize our service and to improve your experience on the website and its subdomains. We also use this information for analytics.