Braintree Gateway
Braintree is credit card processor that doesn’t charge any fees for your first $50k of donations. This article will help you install and configure this Add-on so you can accept donations with the Braintree Gateway quickly and easily.
Having Trouble?
Review our Braintree FAQs here
Getting Started with Braintree
In order to accept payments with Braintree using GiveWP you will need to have an active Braintree account (sign up at their website.), the Braintree Add-on for GiveWP, and the Core GiveWP plugin installed and activated. See here for instructions on installing and activating GiveWP Add-ons.
After your Braintree Add-on is activated, go to “Donations > Settings” and click on the Payment Gateways tab. There you will see the default Payment Gateways (PayPal Standard, Test Payment, and Offline Donations). You should also see Braintree as an option as well. Click on that to enable Braintree as your payment Gateway for your website.
Braintree Gateway Configuration
To start processing transactions with Braintree you must first have an account setup. Got that? Good! Next, let’s collect the following information to insert into the Payment Gateways settings:
- Merchant ID
- Merchant Account ID
- Public Key
- Private Key
To find this information, login to your Braintree account and click Account > My User. Next, scroll down until you see an “API Keys” link. From this screen you will be able to get the Merchant ID, Public and Private Keys:
![Braintree API Keys](https://givewp.com/wp-content/uploads/2015/05/braintree-api-keys.png)
Copy this information to a safe place. Now let’s get your Merchant Account ID.
To obtain your Merchant Account ID click on Account > Merchant Account Info and scroll to the middle of the page:
![Braintree Merchant Account ID](https://givewp.com/wp-content/uploads/2015/05/braintree-merchant-account-id.png)
Braintree Gateway Sandbox Configuration
If you are not ready to accept live payments or you just want to test the donations with test mode disabled, you can use sandbox credentials.
The first step you need to follow is to create a sandbox account here and then log into your account here. You’ll need 4 things:
- Merchant ID
- Merchant Account ID
- Public Key
- Private Key
To find this information, login to your Braintree sandbox account and click on the gear icon on the right top corner > API:
When you click on that, a new page will show up and if you don’t have an API key, then you will need to click on Generate New API Key:
Now that you have the API Key, you will need to click on the View link under the Private Key column and a new page will open and will contain your API credentials. Make sure to copy the Public Key, the Private Key, and the Merchant ID.
Next, you will need to get your Merchant Account ID. To do so, navigate to the right top menu and click on the gear icon > Business:
If you do not have a Merchant Account, then click on New Sandbox Merchant Account and then create a Merchant Account ID and fill the required fields. Save it and now you will have all the necessary information to connect your Braintree sandbox account.
Configuring GiveWP and Braintree
Now that we have collected the necessary information you’re ready to integrate your Braintree account with GiveWP.
Copy each field from the previous steps into the appropriate fields within the Payment Gateway settings.
To enter in your Braintree keys first go to your WordPress site’s admin dashboard. Next, navigate to “Donations > Settings” and click on the Payment Gateways tab. Scroll until you see a section called Braintree Settings. Paste each key into it’s respective field, then hit save:
![Configuring Braintree in GiveWP Settings](https://givewp.com/wp-content/uploads/2015/05/add-ons_braintree-gateway_Configuring-Give-1.png)
That’s all there is to it. Now when your donors come to your site, they’ll be able to use credit cards to donate to you directly in the currency of your country and not have to be redirected to another site.
Frequently Asked Questions
These are questions we often get about the GiveWP Braintree add-on which are more general or broader than the steps above.
FAQs
It’s a good idea to test out a gateway before placing it on a live site. This ensures no donations are lost due to unforeseen errors or issues. So, how do you test Braintree?
Testing Braintree is easy:
- First, ensure you’ve placed GiveWP in test mode (Settings > General > Test Mode)
- Double-check that you have properly inserted the Braintree credentials mentioned above under Donations > Settings > Payment Gateways
- Complete a donation using a test card from the Braintree documentation
- Confirm that the donation is reflected in the Braintree admin dashboard and within GiveWP’s transactions.
- Disable “Test Mode” when done
Unfortunately not at this time.
While the Braintree platform does have recurring payment options, it requires that “plans” are created in their interface before any recurring subscriptions are initiated. According to their development docs, “plans” cannot be created outside their platform at all.
Before creating subscriptions, you must create a plan in the Control Panel. Plans can’t be created, updated, or deleted via the API.
This is a sub-par experience for GiveWP customers which could lead to confusion or broken functionality of recurring payments. Until Braintree supports the dynamic creation of “plans” over their API we cannot support recurring donations with Braintree.
Braintree’s GiveWP add-on, unlike most other payment gateway add-ons, does not have a simple “out of the box” method for passing the donation form title to Braintree. This makes cross-referencing donations from the gateway interface with the GiveWP dashboard more difficult. This document walks you through a custom-code method for sending the form title to Braintree.
Please Note: These instructions need to be followed completely and in the correct order to prevent errors that can cause donations to fail. It is recommended to test these steps in a staging or development environment before doing it in a live site
Adding the custom field to Braintree
Before adding the custom PHP code to your WordPress website, you should add a custom field to your Braintree dashboard that can later be populated by the form Title.
First, click the gear icon in the top right of the Braintree dashboard and then click “Processing”
![the gear icon is on the top right corner of the Braintree interface](https://givewp.com/wp-content/uploads/2019/12/Screen-Shot-2019-12-20-at-8.20.32-AM.png)
From there, scroll down to the “Transactions” section and click on the “Options” link in the “Custom Fields” section.
![the options link is in blue in the Custom Fields section of the page.](https://givewp.com/wp-content/uploads/2019/12/Screen-Shot-2019-12-20-at-8.32.58-AM.png)
Add a new custom field with the API name “form_title” (all lowercase, no spaces) and Display Name “Form Title.”
Select “Store and Pass Back” so that the data is stored on Braintree’s side.
Sending the Data from GiveWP
Now that you’ve got a place for the data to go, you need to add some custom PHP to send that data from GiveWP to Braintree. This custom snippet from the GiveWP snippet library will do that for you.
Note that if you selected a different name for the custom field in the first step, things will need to be modified in that snippet.
If you need assistance implementing custom PHP code on your website refer to this guide.
Once you’ve got the custom snippet active, a new Custom Field shows up in the transaction history on Braintree’s side, displaying the Form Title.