Braintree Environment Setup
Prerequisites
- Users must establish their own sandbox accounts with Braintree in order to use the BroadleafCommerce Braintree payment functionality in a test environment. This can be done here: https://www.braintreepayments.com/get-started
- In order to use PayPal with Braintree, you must follow these steps: https://support.braintreepayments.com/customer/portal/articles/1593802-paypal-setup-guide
- Please familiarize yourself with the Braintree Java API before proceeding: https://developers.braintreepayments.com/javascript+java/sdk/server
Set up your Braintree Account
- Login to your Braintree console
- Generate an API key by navigating to Account > My User > API Keys
- Note these values because they will be needed when you configure your environment properties
Once you have established an account with Braintree, begin by including the Braintree Module dependency to your pom.xml.
<dependency>
<groupId>com.broadleafcommerce</groupId>
<artifactId>broadleaf-braintree</artifactId>
<version>3.1.0-GA</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
Version 3.1.0 uses Braintree library version 2.107.0.
Make sure to include the dependency in your core
pom.xml as well:
<dependency>
<groupId>com.broadleafcommerce</groupId>
<artifactId>broadleaf-braintree</artifactId>
</dependency>
You should now begin to setup your environment to work with Broadleaf Commerce Braintree support.
The first step is to make Broadleaf Commerce aware of your Braintree account credentials.
This is accomplished through environment configuration (see Runtime Environment Configuration).
Broadleaf allows you to create your own property files per environment (e.g. common.properties, local.properties, development.properties, integrationdev.properties, integrationqa.properties, staging.properties, and production.properties)
You will need to enter the following key/value pairs in the appropriate locations and replace the "?" with your Braintree API account details:
You can also store these configs in the Database by utilizing the blSystemPropertiesService
Properties File Config
- gateway.braintree.publicKey=?
- gateway.braintree.privateKey=?
- gateway.braintree.merchantId=?
- gateway.braintree.useRelativeUrls=false
- gateway.braintree.environment=SANDBOX
Production Property Config
- gateway.braintree.environment=PRODUCTION