By Rudderstack Team

How to load data from Braintree to SQL Data Warehouse

How may I load data from Braintree to SQL Data Warehouse for further analysis? The purpose of this post is to help you define a process or pipeline, for getting your subscription-related data from Braintree and load it into SQL Data Warehouse for further analysis. We will see how to access and extract your data from Braintree through its API and how to load it into SQL Data Warehouse. This process requires you to write the code to get the data and make sure that this process will run every time new data are generated. Alternatively, you can use products like RudderStack that can handle this kind of problem automatically for you.

About Braintree

Braintree is a full-stack payments platform that makes it easy to accept payments in your app or website. Our service replaces the traditional model of sourcing a payment gateway and merchant account from different providers. It offers a simple and robust way to accept payments or enable buying from almost anywhere, in your mobile app or online. Braintree gives access to multiple payment methods:

  • Credit / Debit cards: you can accept cards of any type.
  • Apple pay: support for Apple wallet.
  • Android Pay: Accept payments from Android Pay.
  • Venmo: Simplified mobile buying.

It offers simple pricing:

  • First $50K are free of fees
  • There are no minimum or monthly fees
  • After the first $50K the cost is 2.9% + $.30 per transaction

And top notch security:

  • AVS: Helps to verify the provided address.
  • CVV: Ensures that the verification numbers are always validated
  • Risk Threshold: Configure rules to detect fraud

And finally together with all the above, world-class support.

A payment platform like Braintree holds a large number of data related to your company and your customers that are extremely valuable for your business. With data coming from your payment system, you can calculate important KPIs like your revenues and your churn and if you can get access to all the available data your analysts can do wonders. Fortunately, Braintree exposes a rich ecosystem of tools and APIs that you can use to get the most out of your payment data.

About Microsoft Azure SQL Data Warehouse

SQL Data Warehouse is the data warehousing solution that you can use if you are a user of Microsoft Azure. It’s an elastic data warehousing as a service solution, emphasizing its enterprise focus. It also speaks SQL like the previous two solutions and it supports querying both relational and non-relational data. It offers a number of enterprise-class features like support for hybrid cloud installations and strong security. It’s probably the less mature solution compared to the two others though, it’s still in “Preview” mode although accessible to existing Azure subscribers.

Extract your data from Braintree

Braintree, as it is common with payment gateways, exposes an API that can be used to integrate a product with payment services. Access to this API happens through a number of clients or SDKs that Braintree offers:

Instead of a public REST API, Braintree provides client libraries in seven languages to ease integration with our gateway. This choice is deliberate as Braintree believes that in this way they can guarantee:

  1. Better security
  2. Better platform support. And
  3. Backward compatibility

The languages they targeted with their SDKs cover the majority of the frameworks and needs. For example, with the Java SDK, they can also support the rest of the JVM languages like Scala and Clojure.

Braintree API Authentication

To authenticate against the Braintree API and perform either transaction or pull data, the following credentials are required.

  1. Public key: user-specific public identifier
  2. Private key: a user-specific secure identifier that should not be shared.
  3. Merchant ID: unique identifier for the gateway account.
  4. Environment: Sandbox (for testing) or production.

For more information on how to retrieve the above information, you can check the credentials documentation.

Braintree API Rate Limiting

For a system that handles payments, rate limiting doesn’t really make sense. I guess you wouldn’t like to see some of your payments failing because it happens that you have too many customers you are dying to pay you. For this reason, Braintree has implemented some really sophisticated algorithms to ensure that if one of their users goes crazy for any reason, this will not affect the others. So they are actually operating outside of the conventional practices of setting up rate limits. Nevertheless, you should always make sure that you respect the service you are interacting with and the code you write is not abusing it.

Endpoints and Available Resources

The Braintree API exposes a number of resources through the available SDKs, with these you can interact with the service and perform anything that is part of the functionalities of the Braintree platform.

  • Add-ons: returns a collection of all the add-ons that are available.
  • Address: through this resource, you can create and manage addresses for your customers. There’s a limit of 50 addresses per customer and a customer ID is always required for the operations associated with this resource.
  • Client Token: This resource is available for creating tokens that will authenticate your client to the Braintree platform.
  • Credit Card: Deprecated
  • Credit card verification: Returns information related to the verification of credit cards.
  • Customer: your customer with all the information needed in Braintree to perform payments
  • Discount: Access to all the discounts that you have created on the Braintree platform.
  • Merchant Account: information about merchants on the platform.
  • Payment methods: Objects that represent payments
  • Plan: Information about the different plans that you have created in the Braintree platform.
  • Settlement Batch Summary: The settlement batch summary displays the total sales and credits for each batch for a particular date.
  • Subscription: All the subscriptions that have been created on behalf of your customers inside the Braintree platform.
  • Transaction: This functiona