AppFrontier

☰ Menu

Braintree Salesforce Integration Chargent


Connecting Braintree and Salesforce using Chargent


Overview


Braintree, a PayPal Company, is a leader in online and mobile payments, providing extensive tools for developers, multiple different payment type options, and one-touch mobile payments. Braintree was founded in 2007, acquired Venmo for mobile payments in 2012, and was acquired by PayPal in 2013.

With Chargent Payment Processing for Salesforce's prebuilt Braintree integration, you can now connect Salesforce to Braintree in just a few steps. You can then take advantage of Chargent's many features for automating and streamlining payment processes inside Salesforce, including subscription management, embedded Charge, Authorize, Refund and Void buttons for real-time payment management, payment request emails you can send to your customers to capture or update billing details, and more. All of these features initiate transactions directly from your Salesforce account to your Braintree account.


Braintree Logo


 

Setup


  1. Install both the Base Package and a Transaction Package of Chargent Payment Processing for Salesforce into your Salesforce org.

    • Choose Chargent Orders, Opportunities (SFA), or Cases for the second piece that you install, which determines where the Chargent billing fields live in Salesforce.

  2. Trial and Pricing Information

    • Chargent is a paid application, but there is a 30 day free trial that includes our responsive support, no signup required. You can also install Chargent into your Salesforce Sandbox for an extended development period.

  3. Configure Chargent according to the documentation.


    • If you have any questions, we are here to help. Just email us on our support site (best for error messages or more detailed architectural questions) or call +1-415-275-1115 x2

     

    Testing


  4. If you do not already have a Braintree sandbox account for testing, sign up for one at https://www.braintreepayments.com/get-started

  5. Create a Payment Gateway Record in Salesforce for testing Braintree

    • Switch to the Chargent app in Salesforce (top right corner menu)
    • Go to the Gateways tab (click the + beside the tabs if you don't see it)
    • Click New
    • Select Braintree as the record type from the drop-down list of Salesforce payment gateway integration options that Chargent provides.

  6. Your Braintree Sandbox keys can be found on the Home page / Dashboard once you log into Braintree.

  7. Fill out the gateway record in Salesforce as follows:

    • Gateway Name: Your choice, for example "Braintree Test"
    • Merchant ID: Braintree Sandbox Merchant ID
    • Merchant Security Key: Braintree Sandbox Private Key
    • Merchant Reference: Braintree Sandbox Public Key
    • Test Endpoint should be checked
    • Active should be checked
    • Use Tokenization should be checked
    • Click Save

    Braintree Gateway Setup in Salesforce


  8. Create a test record in Salesforce to run some test credit card transactions

    • This will allow you to see how Chargent operates inside of Salesforce, and test to ensure that Salesforce is setup correctly to connect to the Braintree gateway.

  9. Create a New Chargent Order, Opportunity, or Case record (depending on which of the 3 Chargent Transaction packages you installed). Enter data in the following fields:

    • Billing First Name, Billing Last Name, Billing Address, Billing State, Billing Zip, Billing Country should be completed
    • Billing Email

    • Subotal (or Amount if using Opportunities / Cases).
      • Alternately, you can check Manual Charge and then enter a value in the Charge Amount field.

    • Payment Type
    • Card Type
    • Card Number, Card Expiration Month, Card Expiration Year (see below for test cards)

    Braintree Test Order Setup in Salesforce


  10. Braintree Test Cards

    • Keep in mind that Braintree's Sandbox environment will only work with test credit card numbers. Some test numbers will produce approvals, and others will produce declines. The Charge Amount field passed from Chargent to Braintree will also produce different types of Gateway responses.

    • Please see Braintree's documentation for full details.

    • No credit card errors
      These test credit card numbers will not trigger specific credit card errors, although that does not mean that your test transaction will be successful. The Charge Amount can trigger other types of gateway responses.

    • Test Value Card Type
      378282246310005 American Express
      371449635398431 American Express
      6011111111111117 Discover
      3530111333300000 JCB
      6304000000000000 Maestro
      5555555555554444 Mastercard
      4111111111111111 Visa
      4005519200000004 Visa
      4009348888881881 Visa
      4012000033330026 Visa
      4012000077777777 Visa
      4012888888881881 Visa
      4217651111111119 Visa
      4500600000000061 Visa

    • Unsuccessful credit card verification
      The following credit card numbers will simulate an unsuccessful card verification response. Verifying a card is different than creating a transaction. To trigger an unsuccessful transaction, adjust the Charge Amount of the transaction.

    • Test Value Card Type Verification Response
      4000111111111115 Visa processor declined
      5105105105105100 MasterCard processor declined
      378734493671000 American Express processor declined
      6011000990139424 Discover processor declined
      3566002020360505 JCB failed (3000)

    Successful Braintree Transaction in Salesforce


  11. Click the Charge button

    • You will receive a popup window stating the test transaction results
    • After you click OK in the dialog box, the Salesforce page will refresh
    • You can then view the Transaction details from the related list near the bottom of the page in Salesforce, and compare them to the Transactions listed in the Braintree Sandbox.

    Transaction List in Salesforce


    Transaction List in Braintree


     

    Going Live


    Once you have completed some test transactions to see how Chargent works, you are almost ready to go live.

    If you will be doing recurring or subscription billing, you should set up the Apex batch and a few records with the Chargent recurring fields set correctly, so you can use the test Braintree gateway to be sure that everything is configured properly and behaves as you expect before going live with real customer transactions.

    In addition, at this point you can complete any customizations to the Chargent system or Salesforce configuration you might want to do, such as workflow automation, email template customization, triggers, etc.

    To process real transactions with Braintree from Salesforce, you will need to deactivate the test gateway record (uncheck the Active field), and create a new live Gateway record in Salesforce with the production credentials provided by Braintree.

    Note that the Sandbox and Production accounts are completely separate, so you will need to make sure any settings in Sandbox are reapplied in your Production account.

    If you have not applied for a Braintree production account, you can go here: https://apply.braintreegateway.com/

    To set up Chargent and Salesforce to go live, simply do the following:

  12. Create a Payment Gateway Record in Salesforce for live Braintree transactions

    • Switch to the Chargent app in Salesforce (top right corner menu)
    • Go to the Gateways tab (click the + beside the tabs if you don't see it)
    • Click New
    • Select Braintree as the record type from the drop-down list of Salesforce payment gateway integration options that Chargent provides. Chargent uses Authorize.net emulation mode to connect to Braintree.

  13. Fill out the gateway record in Salesforce as follows:

    • Gateway Name: Your choice, for example "Braintree Test"
    • Merchant ID: Braintree Production Merchant ID
    • Merchant Security Key: Production Sandbox Private Key
    • Merchant Reference: Braintree Production Public Key
    • Active should be checked
    • Use Tokenization should be checked
    • Click Save

    Braintree Gateway Setup in Salesforce


  14. You may wish to test a few live transaction with a real credit card, just to make sure everything is working smoothly.

    • Real credit card numbes must be used in production. The test cards for the Sandbox will not work.

    • Run small dollar amount transactions -- you can either VOID them immediately after, to minimize any impact, or allow them to settle to confirm the small amounts are deposited into your bank account

    • Using your own or company credit cards for live tests is recommended, as customers could still see notifications of a charge even if voided

    • Note that Transaction fees are incurred in the live environment, so extensive testing in production is not recommended. Run a small number of small value transactions to complete your testing.

     

    Tokenization


    All Chargent transactions sent from Salesforce to Braintree use tokenization to protect sensitive data and reduce PCI compliance scope.

    When credit card numbers and other details are sent by Chargent from Salesforce to Braintree, Braintree stores that data securely and returns a Payment Method Token, which can be used for future transactions. Chargent stores this in the Token field, and it does not represent a security risk, as it can be only used to reference stored data within Braintree.

    Be sure to consult our Salesforce PCI Guide for information on configuring how credit card data is deleted from Salesforce after submission to Braintree, or consider our features like Payment Console, which can generate Braintree tokens from Salesforce in-memory (without ever being saved to the Salesforce database), to reduce your PCI compliance scope even further.


     

    Field Mapping


    Here are some useful fields and their mappings between the Chargent software in Salesforce and the Braintree system.


    Salesforce Direction Braintree
    Gateway ID < Transaction ID
    Token < Payment Method Token

You have now completed the integration of Salesforce and the Braintree service with Chargent. You can begin processing one-time or recurring credit card and ACH payments through Braintree directly from Salesforce.

If you have any questions or need assistance, please contact us.