Integrating Braintree With Chargent In Salesforce
Salesforce Payments by Chargent is the leading payments application available on the Salesforce AppExchange. Chargent allows you to process payments directly from within Salesforce. This guide shows you how you can easily connect Braintree with Salesforce using Chargent.
About This Guide
This guide walks you through the steps needed to integrate Chargent with PayPal’s Braintree gateway. It assumes you have already installed and configured Chargent, but links are provided to installation, user management, and configuration topics where more detail is available to get you up and running quickly. It also assumes you have already chosen the Braintree gateway and includes links to gateway-specific documentation for configuration instructions.
Video Tutorial
If you’re a visual learner, like many of us, check out our overview video to get started with Braintree. The text in this guide covers the video’s content in greater detail, so if you have any questions, make sure to follow along with the content here.
Before You Begin
Before you start integrating Braintree in Chargent with Salesforce, make sure you’ve completed the following steps.
Installing and Configuring Chargent
Before setting up your gateway, install the latest version of Chargent and configure your user permissions. Guides for these topics are available below to help you get started.
- Installing and Updating Chargent
- License Assignment (Production Only, not required for Sandbox)
- Permission Assignment
Setting Up Your Test Environment
Before installing Chargent in production, we highly recommend installing and testing in a Salesforce sandbox. The following topics provide instructions for obtaining your test gateway credentials and creating a test Gateway record in Salesforce. Remember to refresh your sandbox beforehand to ensure that your sandbox is aligned with your production configurations.
Creating Your Braintree Sandbox Account
If you don’t already have Braintree credentials for testing, you must Create a Braintree Sandbox Account.
Obtaining Your Braintree Sandbox Credentials
To verify your test gateway credentials in Salesforce, Chargent requires the following gateway information:
- Merchant ID
- Private Key
- Public Key
You can access your Braintree Sandbox credentials by following these steps:
- Log in to your Braintree sandbox account.
- Click on the gear icon
in the top right of the screen.
- Click API.
- If you don’t see any keys under the API Keys section, click Generate New API Key.
- When a key is present, click View under the ‘Private Key’ header to see all required credentials.
- Copy the public key, private key, and Merchant ID and save them in a secure location.
Creating Your Test Gateway in Chargent
Now that you have your credentials in hand, it’s time to create a gateway record in a Salesforce sandbox and verify your Braintree sandbox credentials.
- Login to your Salesforce sandbox (partial, full, or developer sandboxes work).
- Go to the App Launcher
and click the Chargent app.
- Click the Chargent Settings tab and choose the Setup Wizard subtab.
- Click Yes when prompted, “Do you have a Payment Gateway account?”.
- Select ‘Braintree’ from the list and click Continue.
Note: In your Salesforce sandbox instance, Chargent automatically sends your transactions to your gateway’s test endpoint URL to ensure you don’t accidentally send live transactions from your Salesforce sandbox environment.
If your testing process requires creating live transactions in your sandbox environment, see Running Live Transactions in Sandbox.
- Enter your Braintree sandbox credentials, leaving the Endpoint Override field blank.
- See Merchant Account ID if you plan to process payments for multiple business units or currencies using Braintree’s Merchant Account feature.
- Click Sign In.
- When you receive a message stating “Your credentials have been successfully verified!”, click Continue to complete the steps in the wizard.
- If you receive an error message in red, see the Checking Your Remote Site Settings section below or check out our troubleshooting tips.
The remaining choices in the Gateway Setup Wizard are determined by your specific use case. For more detailed information about the steps, see Gateway Setup Wizard.
The remote sites for your gateway should automatically activate when completing the Gateway Setup Wizard. If you encounter any issues connecting to Chargent using your gateway credentials, ensure they have been correctly activated in your org.
- Click the gear icon
at the top right and choose Setup.
- Enter “remote” in the Quick Find box and choose Remote Site Settings.
- Locate the following Remote Site names and make sure the “Active” box is selected:
-
- Braintree_Test
- Braintree_Live
- If the “Active” box is not selected, click Edit, select Active, and click Save.
Setting Up Your Direct Debit Network
Setting up your Direct Debit Network is optional but recommended. When you reach the Gateway Setup Wizard page labeled “Select the Payment Methods you accept,” select the Direct Debit Network for your region.
Braintree supports the ACH – US Direct Debit Network. Choosing the correct Direct Debit Network will allow you to accept Bank Account payments and display the correct Direct Debit Network fields in Chargent.
Learn more by visiting Understanding Bank Account Payments.

Running Test Transactions
After successfully creating your test gateway record, you can attempt your first test transaction. See Testing in Sandbox for instructions and best practices for testing. Every gateway has its own test payment methods and response codes. See the list below for information and resources specific to Braintree.
Testing Credit Card Transactions
Visit Braintree’s documentation, Credit Cards – Testing and Go Live, for a complete list of test credit card numbers. To quickly verify your integration, you can use the following test credit card number to ensure Chargent is appropriately configured:
Processing Network | Card Number | Expiration | CVC |
---|---|---|---|
Visa | 4111111111111111 | Any date in the future | Any 3-digit number |
Mastercard | 5555555555554444 | Any date in the future | Any 3-digit number |
American Express | 378282246310005 | Any date in the future | Any 4-digit number |
Discover | 6011000991300009 | Any date in the future | Any 3-digit number |
Testing Bank Account Transactions
Visit Braintree’s documentation, ACH Direct Debit – Testing and Go Live, for a complete list of test bank account numbers. To quickly verify your integration, you can use the following test bank account information to ensure Chargent is appropriately configured:
Routing Number | Account Number | Bank Name | Account Type |
---|---|---|---|
Any 9-digit number | 1000000000 | Any bank name | Checking |
Testing Response Codes
It’s important to test different gateway responses to ensure that your gateway is configured properly. The gateway’s response is stored on a transaction record (see the Response Code and Response Status fields) in Salesforce.
Every gateway has its own response codes. You can test response codes by inputting specific billing information, as noted in the following guides:
For example, you can test the following credit card numbers to generate a specific response code:
Card Number | Processing Network | Expected Response |
---|---|---|
4000111111111115 | Visa | Declined |
378734493671000 | American Express | Declined |
3566002020360505 | JCB | Failed |
It is not considered best practice to run live transactions in your sandbox environment. If you still wish to send live transactions from a Salesforce Sandbox as a final step in testing, add the Braintree Production Endpoint URL noted below to the Endpoint Override field on your gateway record. You will also require your gateway’s production credentials, which can be obtained by following the steps in the next section of this guide.
Braintree Production Endpoint URL: https://www.braintreegateway.com/
For more information, see Testing Live Transactions in Sandbox.
Going Live in Production
Once you’ve tested your gateway integration in a Salesforce sandbox, you’re ready to move to production. See Moving from Sandbox to Production to learn how to migrate your Chargent configuration changes to your production environment. After moving Chargent to production, see Testing in Production for best practices prior to going live.
Obtaining Your Live Gateway Credentials
Contact Braintree’s Sales Team to create a live Braintree account, where you can find your live gateway credentials. Your production credentials will differ from your sandbox credentials. To process live transactions in your production environment, create a new gateway record in Salesforce using the credentials for your live Braintree account by following the instructions in the next section.
Creating Your Live Gateway Integration in Salesforce
So far, you’ve used your test Braintree credentials and created a test gateway in your Sandbox. Now, it’s time to create a new gateway record in your production environment specifically for processing live transactions.
- Log in to your production Salesforce org.
- Go to the App Launcher
and click the Chargent app.
- Click the Chargent Settings tab and choose the Setup Wizard subtab.
- Click Yes when prompted, “Do you have a Payment Gateway account?”.
- Select ‘Braintree’ from the list and click Continue.
- Click Live Transactions and enter your new live gateway credentials, leaving the Endpoint Override field blank.
- See Merchant Account ID if you plan to process payments for multiple business units or currencies using Braintree’s Merchant Account feature.
- Click Sign In.
- When you receive a message stating “Your credentials have been successfully verified!”, click Continue to complete the steps in the wizard.
- If you receive an error message in red, see our troubleshooting tips.
For more detailed information about these steps, see our documentation for the Gateway Setup Wizard.
Running Live Transactions
With your live gateway record created, you are ready for the final phase of testing: running live transactions in a production environment. Visit Testing in Production for considerations and best practices related to testing in your production environment.
When testing with live payment information, you can prevent transactions from settling by voiding them immediately afterward. For more information, see Refunding and Voiding Transactions. As a precaution, we recommend using very low amounts to minimize any impact in the event you forget to void them.
To test gateway responses in the live environment, submit live transactions with the correct street address, zip code, and CVC information to generate successful responses. Likewise, submit incorrect street address, zip code, and card code information to generate other responses. You can void successful transactions immediately to prevent live test transactions from being processed.
Congratulations! You have successfully integrated Salesforce and Braintree! You can now process one-time or recurring credit card payments through Braintree directly in Salesforce using Chargent!
Supported Features
All of Chargent’s gateway integrations support most of Chargent’s core features. Some features are reliant on support by the gateway itself. Chargent’s integration with Braintree includes, but is not limited to, the following features:
ACH Validation
Using Braintree, you can validate US bank accounts on the Automated Clearing House (ACH) network via Lyons ACH Validation before the transaction is attempted. This feature is designed to satisfy NACHA’s mandate—Supplementing Fraud Detection Standards for Web Debits.
For more information, see ACH Validation.
Address Verification System (AVS)
Chargent’s integration with Braintree supports Address Verification System (AVS), a technology used to prevent fraud by validating the ownership of a credit card using the billing address of a credit card and matching it with the data on file at the credit card issuing company.
Your AVS results are stored in Salesforce using the AVS Response Code field on your transaction record. For code definitions, see Braintree’s AVS Response Codes.
For more information, see Address Verification System (AVS).
Currencies
Chargent’s integration with Braintree supports the following currencies: Braintree Currencies. See Merchant Account ID if you plan to process payments for multiple business units or currencies using Braintree’s Merchant Account feature.
Additionally, this gateway integration supports Salesforce’s Multiple Currencies feature.
For more information about currencies in Chargent, see Understanding Currencies.
Chargent supports Braintree’s multiple Merchant Account functionality. A single Braintree gateway account can have multiple Merchant Accounts designed to process transactions for different business units or currencies. Contact Braintree to get started with multiple Merchant Accounts.
In Chargent, you can create multiple gateway records, each related to a unique Merchant Account ID (which is different from the Merchant ID, a unique identifier for your gateway account).
When creating your gateway record in Salesforce using the Gateway Setup Wizard, populate the Merchant Account ID field associated with your merchant account.

When making payments in Salesforce, your users or processes can now select the gateway record tied to a specific Merchant Account ID.
Customers with only a single merchant account who don’t plan to utilize this feature can leave the Merchant Account ID field blank in the Gateway Setup Wizard.
Data Levels
Data levels allow you to send more information with each transaction, ensuring the security and authenticity of the payment. Higher data levels translate to higher savings on transaction fees. The following levels of data are supported by Braintree using Chargent:
- Level I
- Level II
For more information about data levels, see Understanding Data Levels.
Payment Method Types
Below, we’ve listed the payment method types that are supported when using the Braintree gateway integration. For more information about payment methods supported by Chargent, see Payment Methods Supported.
Credit Cards
- Visa
- Mastercard
- Discover
- American Express
- MC Eurocard
- UK Maestro
- JCB Card
- Diners Club
For more information, see Understanding Credit Card Payments.
Bank Accounts
- ACH – US (see the ACH requirements below)
Required: To accept ACH payments via Braintree in Salesforce, you must complete the following steps:
1. Install or update to Chargent version 7.80 or higher. Updating is free and provides you with the latest and greatest Chargent resources. Not sure what version of Chargent you’re on? Find out now!
2. Contact Braintree to add ACH functionality to your Sandbox or Production gateway account. ACH support is not activated by default.
For more information, see Understanding Bank Account Payments.
Surcharging for Card Payments
Surcharging represents a growing trend in the payment industry, allowing you to pass your credit card fees on to your customers. Chargent has partnered with InterPayments, a leader in the surcharging space, to help you take control of your credit card fees and improve your Salesforce payment process.
To learn more, see Setting Up Surcharging.
Tokenization
Tokenization allows you to store payment information at your gateway and not in Salesforce. Tokenization helps you decrease the scope of your PCI compliance and improve security by storing your customers’ payment information on Braintree’s servers and not in Salesforce.
Chargent’s Braintree integration supports tokenization for the following payment method types:
- Credit Card
- Bank Account
The token returned by Braintree is stored in the Token field on the Chargent Order and Tokenization on the Transaction records in Salesforce. Additionally, tokens are stored in a Chargent Tokens record when Payment Methods is enabled in your org.
To learn more, visit Understanding Tokenization.
Transaction Sync
Chargent sends charges and authorizations to the payment gateways, recording the result in a real-time transaction in Salesforce. Chargent also updates Salesforce records long after the initial transaction if, for example, ACH transactions are returned for non-sufficient funds (NSF) or credit card authorizations that expire.
The following list represents potential final transaction status values for Braintree. Visit Braintree Statuses for definitions.
- authorization_expired
- settlement_declined
- settled
- voided
- processor_declined
- gateway_rejected
- failed
- voided
- submitted for settlement
- settling
- settled
- settlement declined
- settlement pending
We recommend setting up Transaction Sync in your org.
Transaction Types
Chargent’s integration with Braintree supports the following transaction types:
- Authorize
- Capture
- Refund
- Partial Refund
- Credit
- Void
For more information about Transaction Types, see Understanding Payments.
Field Mapping
Salesforce sends payment information to your gateway based on the field values in your Chargent Order records. Braintree stores the payment information as a transaction in your Braintree account. Then, Braintree returns a response to Salesforce, storing it in a Transaction record. Here are a few important examples of how the data is mapped between Salesforce and Braintree.
Chargent Field | Salesforce Object | Direction | Braintree Field |
---|---|---|---|
Gateway ID | Transaction | > | ID |
Token | Chargent Order | < | Payment Method Token |
Invoice Number | Chargent Order | > | Purchase Order Number |
Order Information | Chargent Order | > | Order ID |
Billing First Name | Chargent Order | > | First Name |
Billing Last Name | Chargent Order | > | Last Name |
Billing Company | Chargent Order | > | Company |
Billing Address / Billing Address 2 | Chargent Order | > | Street Address |
Billing State / Province | Chargent Order | > | Region |
Billing Zip Code / Postal Code | Chargent Order | > | Postal Code |
Billing Country | Chargent Order | > | Country Code |
*The Invoice Number and Order Information fields allow you to send custom invoicing or additional information about your transaction. Chargent does not automatically populate these fields.
ACH Hosted Fields
Hosted fields represent field values securely hosted on Braintree’s servers but displayed in Salesforce. Using hosted fields reduces the scope of your PCI compliance by keeping sensitive data from being stored in Salesforce. Chargent’s Braintree integration displays the following Hosted Fields for ACH payments on Take Payment, Payment Request, and Payment Console screens:
- Routing Number
- Account Number
- Account Type
- Bank Name
- Ownership Type
- Address Line 1
- Address Line 2
- City
- State
- Zip Code
Gateway Response Codes
The Reason Code field on a Transaction record stores a response code provided by Braintree. To learn more about status responses from Braintree, see Braintree Statuses.
To review gateway responses in Salesforce, go to the transaction record in Chargent and examine the following field values:
Transaction Field Name | Description |
---|---|
Response Status | The state of the transaction, such as “Approved,” “Declined,” or “Error” received from the payment gateway. |
Reason Code | The code provided by the gateway, indicating why the transaction was successful or not. Braintree stores a code of 1000 for successful transactions. See Processor Responses for more information. |
Gateway ID | Corresponds to the transaction ID in the gateway. Use this field to reconcile your Salesforce transaction records with your gateway’s transaction records. |
Gateway Response | Contains the entire message received from the gateway and stored in the Salesforce transaction record. This field is helpful when troubleshooting your transactions. |
Troubleshooting
If you are having trouble connecting to your gateway, we recommend starting with these troubleshooting steps.
For additional troubleshooting tips or frequently asked questions about Braintree, check out Chargent’s Knowledge Base.
Getting Help
Contacting Braintree Support
Please reach out to Braintree for gateway-specific support.
Contacting Chargent Support
Contact our support team if you encounter any issues with your Chargent implementation.