Payment Integration — Braintree
Braintree, a division of PayPal, is a company based in Chicago that specializes in mobile and web payment systems for ecommerce companies. Braintree emphasizes its easy integrations, multiple payment method options (including PayPal and Venmo), simple pricing, security, and support.
Braintree provides its customers with a merchant account and a payment gateway, along with various features including recurring billing, credit card storage, support for mobile and international payments, and PCI compliance solutions.
Braintree provides two methods of payment:
- Credit Card
In order to integrate Braintree payments, a Braintree merchant account should be created and configuration data then could be obtained from Braintree.
There are two types of accounts for the integration:
- test accounts
- live accounts
Both accounts share the same configuration with different values. Braintree uses the idea of having merchants for handling different requests. Each merchant is defined by a merchant ID which will be given by Braintree.
We use state machines for handling and managing orders and payments. To integrate Braintree payments, a state machine for Braintree should be created.
A basic and fully functional state machine is already built (BraintreePayPal01 and BraintreeCreditCard01). You can use the same state machine or build a new one. In case a new state machine has to be built, it is preferred to contact Braintree and confirm the new state machine design and functionality.
The state machine commands and conditions trigger Braintree facade calls in order to perform the needed requests to Braintree. For simplicity, the Braintree facade uses the same calls for both credit card and PayPal payments and automatically distinguishes between the payment methods from the payment entity.
Because of PCI compliance reasons, credit card data is communicated to the third party through JS and AJAX calls (sensitive information stays browser side).
- Configure Braintree
- Perform requests with Braintree
- Familiarize yourself with the Braintree workflow
Last review date: Dec. 22nd, 2017