I recently reached the point that I needed to integrate a payment platform in a React Native application. Fortunately, there are many user friendly payment providers available for use in mobile applications. I decided to choose Braintree due to its built in Paypal integration. However, I believe the techniques covered in this article can be applied to working with other payment providers.
Not only are there several payment providers, there are multiple payment libraries that work with React Native applications. A quick Google search shows that there are several for Braintree specifically. However, I required a solution that excluded native code due to my applications integration with Expo, and unfortunately, all the current (at the time this article was published) cross platform solutions require some amount of native code.
This meant that I needed to create my own…
That feeling you get when you can’t find what you need in npm.
So, in this series of posts, I will walk through creating a JavaScript only (no native code) Braintree payment component, and releasing that component as an NPM package. The posts are divided as follows in order to keep each article “bite-sized”:
The three different code based portions of this series
My goal is that writing these articles will force me to improve my knowledge of the listed topics, document what I’ve found for future reference, and help others who have the same requirements.
I anticipate that this series will have applicability that reaches beyond React Native. For example, I will discuss server integration using AWS Lambda (which itself has applicability to node.js). Also, React Native (RN) is at its core React which itself is built on HTML & JavaScript, so don’t let my focus on RN turn you off. There will also be some webpack and CSS along the way. Finally, all payment systems that I’ve seen have a token based authentication and authorization system that is eerily similar to a third party authentication system.
Bottom line is that don’t let the type of hammer I use distract you from building the dog house. The techniques are the important part, not necessarily the tool.
I will briefly cover the project’s anticipated design here. However, each article will have a more in depth design discussion related to that particular stage.
At a big picture level, the project will enable the following:
Now, lets break down each of those steps a little bit.
Once again, more specifics will be presented in subsequent articles, but at a high level I know I need an application server to perform server functions. I’ll use an AWS Lambda function couple with AWS API Gateway for this functionality. Additionally, you’ve probably gathered by now that I intend to used React Native to build a mobile client that interfaces with the user and the application server.
That’s it for now. Hopefully this article has described what I intend to do, how I intend to do it, and why I’m doing it this way. I hope you will stick with me for the rest of the articles in this series.