Yalantis: iOS, Android And Web App Development Company

Stripe or Braintree?

While there are multiple solutions for processing payments via mobile apps, Stripe and Braintree stand out as the most efficient payment systems. I decided to compare the two so that our clients have an easier job choosing the most appropriate payment system for their app’s needs.

Braintree and Stripe both have SDKs for iOS and Android. Speaking of the libraries they support on the server side, you can always check them here and here. I checked their pricing plans, documentation intelligibility, and the way they both work from set up to features and anti-fraud tools. So let’s start digging in!

What’s the difference in price?

I’d start with saying do not forget to specify the country, since conditions and pricing plans are quite different. Both platforms support payments from anywhere in the world. However, your app must be a resident of one of the supported countries. Braintree has managed to land in 40 countries and Stripe has only 18 in their list for now.

*Stripe is in a private beta in Austria, Italy and Switzerland. If you are located in one of those, you can request an invite from Stripe.

Since the amount of money you will have to pay depends, I decided to check how things work for the USA. Braintree and Stripe have both 2.9% + 30¢ per transaction fee. But Braintree has a cool offer for starters. As soon as you setup your account and the total sum of your transactions won’t exceed $50,000, no payment will be a subject for Braintree’s interest rate. You can use the system free of charge. The only thing is a chargeback. You will have to pay a standard $15 fee per each and I haven’t found a word saying you can defend the case.

If we compare additional expenses, Stripe has minimum of those and with a pleasant customer support. For example, in case your client asked for a chargeback, Stripe will withdraw 15$ from your account, but will give it back once you successfully prove they really should. Read more about how this happens in Stripe and Braintree.

In general, I’d say Stripe describes their pricing plans with a greater transparency and clarity. It’s immediately clear what amount will be removed if the transaction is successful.

Stripe also says they charge no costs for refund in all the countries they support. Whereas in Braintree this depends on the country — in Australia they charge $0.30, but in the USA there is no fee.

To sum up, it’s really hard to say which service will suit you best only by looking at their pricing plans. It all depends on your type of app and the amount of money it will handle. If you are on a large amount of transactions, but will minimize the possibility of chargebacks, Braintree might be best. But if you have an e-commerce app and the probability of product return by our customers is high, then I’d advise Stripe.

Read about pricing details in Stripe and Braintree.

Whose documentation looks awesome?

Stripe has a pretty usual documentation in conservative «Apple style». But it looks like they do not fully support it. Android tutorial says I need to download their SDK as a project. But on Github, where there is an example for using their SDK, they say I can use Gradle and give their instructions. This is not such a big issue, but you might miss it.

Stripe vs Braintree

Braintree pleasantly surprised me. At first, when I looked at their developer’s site, I couldn’t understand if they only support iOS for client and Ruby for server side, since I saw examples for these languages only. But then I discovered they have a really amazing navigation at the top of the page, which lets you choose a client’s platform and a corresponding server’s. You can be at one and the same page and choose any platform you like. Code in the given examples will change respectively.

This is just super awesome!

Braintree vs Stripe

Braintree did a really great job in designing their web pages. They avoided cluttering their documentation with a bunch of links to different platforms and tutorials and made it look clean.

How it works

Each of the payment systems provides you with Server SDK, which you need for processing transactions through their systems.

In order to make payment on the client side, Braintree generates a token using Braintree Server SDK. Token is an object designed to store configuration settings and authorization necessary for Braintree Client SDK. In the client’s code the token looks like a line which represents a JSON model encrypted with the help of Base64. You can see how it all works in your Braintree Client SDK. At least I had such opportunity in my Android Braintree SDK.

The token you receive is used to work with Braintree Client SDK. This SDK will connect with Braintree server and send you payment method nonce, a line generated by the Client SDK, which describes which payment method a user chose (credit card, PayPal account, etc.). You should send this line to your server. On your server payment method nonce carries out Braintree payment operations using Braintree Server SDK.

Stripe or Braintree?

If we talk about Stripe, a token should be generated by the client with the help of Stripe Client SDK and then sent to the server. The 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 without changing anything or by adding your own encryption to it. On the one hand, your own encryption will provide better security when communicating your client with the server. But on the other hand, encryption is not a must. Stripe gives an extra warning in their documentation saying you need to use SSL connection on your server side without which you won’t be able to interact with Stripe server, as they use HSTS protection mechanism. Read more about Stripe security here. After your server gets the token, you can process payments using Stripe Server SDK.

Let’s code!

I am going to dwell on Android coding experience. If you need iOS or whatever else, welcome to the documentation.

Setup

In both systems, there is an SDK in maven repository, which simplifies the process of getting started.

Braintree

compile 'com.braintreepayments.api:braintree:<version>'

Stripe

compile 'com.stripe:stripe-android:<version>'

Even though documentations of both systems suggest to use automatic incrementation of versions till the final one, I advise a concrete version of library. This way you can avoid possible bugs in your code dealing with deleting or updating SDKs. See the latest versions of SDKs for Braintree and Stripe.

This is enough for setting up Stripe. Braintree set up process also ends up here. But they have a range of other possibilities that involve some extra features.

Braintree Android SDK offers to use their standard screen for payments called Drop-in. It has all the necessary functionality, including current and future Braintree possibilities, such as payment with Bitcoin, for example.

To use Drop-in, you need to add Activity from their SDK in the manifest file:

<activity android:name="com.braintreepayments.api.dropin.BraintreePaymentActivity" />

Again if you don’t need anything else from Braintree, such as PayPal or Venmo support, you can start processing payments via their standard UI. You can check other extra settings here.

As you see Braintree SDK offers more possibilities for different payments and minimizes developer effort.

You can simply create an account, copy the code from the documentation and insert it in yours and then process payments through your app. Braintree seems to be a great choice!

Read also: What’s wrong with open source Telegram?

Custom screen for payments

With Braintree you need to get a client token every time you make a transaction. After you received all the necessary information from the client’s credit card, you should use CardBuilder class.

CardBuilder cardBuilder = new CardBuilder()

               .cardNumber(cardNumber)

               .expirationMonth(cardMonth)

               .expirationYear(cardYear);

You can use the following format of expiration dates instead of two last rows: «12/2025» or «12/25».

You may also add a method validate (true) to this builder. It’s needed if you want to validate the card immediately on the client side and avoid extra requests to the server. Otherwise, card validation will happen on the server side with the help of Braintree library. To increase security you should read the article from Braintree and add CVV to the builder.

Then you should create or get a Braintree object using the client token you received. In order to get payment method nonce you must add PaymentMethodNonceListener.

To handle errors, which can emerge when carrying out payments, you should add ErrorListener and implement the logic of error handling in the method onRecoverableError.

Then you can call tokenize method of Braintree object with cardBuilder object, which you created and receive payment method nonce.

Braintree braintree = Braintree.getInstance(this, clientToken);

       braintree.addListener(new Braintree.PaymentMethodNonceListener() {

           @Override

           public void onPaymentMethodNonce(String paymentMethodNonce) {

               // Here you should use your API implementation magic and send paymentMethodNonce to your Server

           }

       });

       braintree.addListener(new Braintree.ErrorListener() {

           @Override

           public void onUnrecoverableError(Throwable throwable) {

               //Nothing to do here. Exception cannot be handled.

           }

           @Override

           public void onRecoverableError(ErrorWithResponse error) {

               //TODO: Implement here handling errors.

           }

       });

       braintree.tokenize(cardBuilder);

That’s it! You can send your paymentMethodNonce to the server and it will do all the magic. When connecting Stripe I noticed that their Android SDK has a dependency with their JAVA SDK. What is more, this dependency doesn’t apply to the latest version. So be prepared for errors if they update the version. If you use Stripe, you will have to communicate with the server during payment processing less than if you use Braintree.

At first you should create an object Card with the data received from your UI. Then you should create a Stripe object with your publishable key, which you can find on the dashboard and call a method createToken from the Stripe object. You don’t have to create a server request to validate the data a user entered. You can do it through Stripe Android SDK.

Card card = new Card(cardNumber, 12, 2025, cvv);

 // Make validation in your way if you want

       if (!card.validateCard()) {

           if (!card.validateCVC()) {

           }
           ...

           if (!card.validateNumber()) {

           }

       } else {

           try {

               Stripe stripe = new Stripe(PUBLISHABLE_KEY);

               stripe.createToken(card, new TokenCallback() {

                   @Override

                   public void onError(Exception e) {

//TODO: Implement here handling errors.

                   }

                   @Override

                   public void onSuccess(Token token) {

// Here you should use your API implementation magic and send token to your Server

                   }

               });

           } catch (AuthenticationException e) {

               e.printStackTrace();

           }

       }

I got the feeling that Stripe SDK is not properly supported. I liked Braintree’s much more.

Testing and test data

Braintree provides Sandbox which is a copy of production panel for managing Braintree account. You can get testing values of API keys needed 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 with. You can see how this happens here.

So you have two separate accounts for Sandbox and for Production. On the one hand, Sandbox allows you to many 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 will have to configure that all again in the Production account.

braintree_sandbox

Braintree provides instructions about which testing cards and data you can use in Sandbox. If you don’t have a server yet, which can generate client token, there is an already generated key in the documentation.

For Stripe you use one and the same account for testing and production. They have a single site with control panel, which indicates if you are in the testing mode. In order to get into production, you simply need to press the button and activate account. Stripe also gives their testing instructions.

I like this approach more than two separate accounts. We can test as much as we need and then simply go into Live without changing configuration settings.

Read also: mBaaS platforms compared

Features

Basic functionality for proceeding payments for both services is the same. They provide recurring payments (see Braintree, Stripe) with possibilities for discounts, add-ons and so on. However, the main set of features they offer differs. You can check the list here and here.

Other than basic possibilities, Braintree also supports payment via PayPal (it’s PayPal’s company after all) and Venmo, which is PayPal’s delegate company. You can enable Venmo in the control panel of your Braintree account. See Braintree overview about the possibilities of their control panel.

So if your user has both PayPal and Venmo apps, they don’t have to enter their credit card data in your app. In case your users don’t have Venmo account, they won’t have the option to pay using Venmo app. However, «pay with PayPal» button will lead the user to their PayPal account asking them to login, in case they don’t have PayPal app installed.

Braintree also has One-Touch feature. The idea is to let the user pay instantly in their app by redirecting them to PayPal or Venmo apps on their devices.

stripe_dashboard

Stripe has a really great intuitive dashboard.

Anti fraud tools

Braintree seems to be great in security! They created a safe to use SDK with a token encrypted using Base64 generated on the server without storing any key on the client side. They also have partnered with Kount to provide additional security measures for server and client side data. To access it you should simply integrate the code. See Braintree review of the security tools.

Stripe explains how to avoid fraud and launch a program of machine learning to determine fraud. I am sure Stripe has the same level of security as Braintree. But in order to fully uncover it, we would need a separate article.

In Braintree you can add additional configuration settings to CVV validation to prevent fraud, such as:

  • CVV does not match (when provided) (N)
  • CVV not provided (I)
  • CVV is not verified (when provided) (U)
  • Issuer does not participate (when provided) (S)

And Stripe doesn’t offer the same flexibility: — Decline on CVC failure

Read also: Data security mechanisms

Conclusion

Braintree has a much bigger set of features and they are working hard to expand the coverage. All in all, I’d prefer Braintree. It is comfortable to work with and I am impressed by a wide range of possibilities for payment using different systems and a variety of ways. Judging from their blog, the company keeps pace with the times, which can not but make me happy. Stripe is also great depending on what you need.

You can check Braintree and Stripe support pages for detailed information.

In case you need some advice about which system to choose to enable payments in your app, we’ll be glad to help you figure it out!

Follow us on Github.         

Insights

Mint Personal Finance App Technology

Tech

Mobile App Payment Gateway Integration

Tech

How Do You Integrate Apple Pay Using Stripe For Your Shopping App?

Tech

How to Develop a Bitcoin Wallet App

Tech

How to Innovate Your Mobile Payment Application?

See what else we can do

Check out our knowledge and capabilities

Let's talk code