Commerce v1 Modules Payments Braintree

The Braintree payment gateway is included in the Commerce core, and does not need a module to be enabled. It does need to be configured as a payment method.

Braintree is a PayPal subsidiary that allows you to accept payments with Credit/Debit Cards and digital wallets such as PayPal, Apple Pay, Android Pay and Bitcoin. It has no monthly fees, just transaction fees.

Commerce uses the so called Drop In integration, which embeds the payment form into your page with JavaScript and an iframe, allowing you to sidestep PCI compliance horrors. Control over the design of the payment form is fairly limited.

Creating the Payment Method

In the Commerce dashboard, to go Configuration > Payment Methods. Click the Add a Payment Method button and choose Braintree in the Gateway dropdown. Fill in the other fields and save.

Alpha Note: There's a known bug where saving again after creating the payment will cause duplicate records. To prevent this, close the modal and click the name of the gateway you just created to edit it further.

After having saved the payment method, you'll get access to the Gateway Options for Braintree. These are:

  • Public Key
  • Secret Key
  • Sandbox
  • Merchant ID

You'll likely need to create two payment methods; one for testing using your sandbox credentials, and one for live with the live credentials. Set the availability appropriately.

Locating your Credentials

  1. Login to your Braintree account or the sandbox
  2. Navigate to Account > My User in the top navigation
  3. Click View Authorizations towards the end of the page, under the API Keys, Tokenization Keys, Encryption Keys heading.
  4. Under API Keys, click Generate New API Key.
  5. Click View in the Private Key column. This gives you all the keys you need to copy to the Payment Method in Commerce.