Payment Processing with Braintree

You’ve built the web application of the century, and the users have rightly flooded to it. Cat pictures for everyone!

But alas, while your users indulge in cat-induced bliss, the cold hard reality of server costs cannot help but harsh your mellow. What is to be done?

Maybe, you could get the users to… pay for access to your incredible web application in all its multivarious splendour?

Braintree is a payment processor (now a subsidiary of PayPal), which boasts of a “simple, robust way to accept payments”, and with features like a drop-in payment ui and libraries for various programming languages enabling fairly easy integration, is a solid choice for accepting payments via credit card or PayPal.

While Braintree’s developer documentation is blessedly detailed, it’s possessed of a potentially confusing bevy of options, and its various implementation examples are spread out amongst a number of pages and platforms. So today, rather than reiterate any particular section of the docs, we’re going to take a look at an end-to-end example of a specific, straightforward scenario – accepting and processing a one-time, immediately settled payment in a web application.

(more…)