🎉 Celebrate with 10% OFF on All Products! Use Code: GFEX10 Or Buy Any 2+ Items for 30% OFF with Code: GFEX30!

Gravity Forms Braintree Payment Premium Add-on Setup Guide

Updated 10 min read Gravity Forms Payments & Pricing
On this page
  1. What you need
  2. Install and activate
  3. Connect your Braintree account
  4. One merchant account per currency
  5. Choose the payment methods
  6. 3D Secure 2
  7. Add a Braintree feed to a form
  8. Subscriptions
  9. Webhooks
  10. Capture, void and refund from the entry
  11. Notifications
  12. Test before going live
  13. Logging and privacy
  14. For developers
  15. Frequently asked questions
  16. Do card numbers touch my server?
  17. Which currencies are supported?
  18. Can I take a deposit now and the rest later?
  19. What happens if the customer closes the page during 3D Secure?
  20. Does it work with AJAX forms and multi-page forms?

The Gravity Forms Braintree Payment Premium Add-on takes payments with your forms through your own Braintree account. The Braintree Drop-in UI appears right on the form, above the submit button, so your customer pays by card, PayPal, Apple Pay or Google Pay without leaving the page. Card details are typed into fields that Braintree hosts, so they never reach your website. When the form is sent, the add-on charges the total that Gravity Forms worked out on the server and saves the entry as paid. This guide covers what you need, connecting Sandbox and Production, the feed, 3D Secure, subscriptions, webhooks, refunds and the questions merchants ask most.

What you need

  • WordPress 6.5 or newer, PHP 7.4 or newer (with the openssl and DOM extensions, which almost every host has) and Gravity Forms 2.9 or newer.
  • A Braintree account. A free Sandbox account is enough to test everything; for real payments you need an approved Production account.
  • Your merchant id, public key and private key for each environment. In the Braintree Control Panel open Settings, then API, and generate a key pair if you have none.
  • At least one merchant account in the currency of your forms. A merchant account in Braintree decides the currency a payment is taken in.
  • Your site on HTTPS. The payment fields need a secure page, and Braintree only sends webhooks to HTTPS addresses.
  • A form with at least one product field and a total. Donations work the same way.

The add-on talks to the Braintree GraphQL API: payments.sandbox.braintree-api.com in Sandbox and payments.braintree-api.com in Production. On pages that show a form with a Braintree feed, the visitor’s browser loads the Drop-in script from js.braintreegateway.com, as Braintree requires. Other pages load nothing extra. Apart from that, the add-on checks gravityextra.com for your licence and plugin updates.

Install and activate

  1. In WordPress go to Plugins, Add New, Upload Plugin, choose the zip file and click Install Now.
  2. Activate the plugin.
  3. Open Forms, Settings, Braintree, paste your licence key and click Activate. The Braintree settings appear once the licence is active.

Connect your Braintree account

The settings page has one block of keys for Sandbox and one for Production. You can fill in both and switch between them with the Environment option. Sandbox is the default, so nothing real happens until you choose Production.

Braintree settings: Sandbox or Production, the merchant id, public and private key for each, the merchant account per currency, the connected status with the merchant accounts found, payment methods and the 3D Secure 2 options
Settings: choose Sandbox or Production and enter your Braintree keys. They are checked when you save, and the private key is stored encrypted.
  1. Choose Sandbox (test) as the environment.
  2. Paste the Sandbox merchant id, public key and private key from the Braintree Control Panel.
  3. Click Save Settings. The add-on asks Braintree to confirm the keys and lists the merchant accounts it found, with their currency. If Braintree refuses the keys, nothing is saved and the field shows why.
  4. Check the Currency line: it shows which merchant account takes the payments for the currency your forms use.

The private key is stored encrypted with a key that only your site has, and it is never shown again: the field keeps a placeholder. The public key is shown masked in the connection line. When you are ready for real payments, fill in the Production keys, choose Production and save again.

One merchant account per currency

Braintree takes every payment in the currency of the merchant account it uses. The add-on picks the merchant account for the currency of your forms on its own: an account in that currency, the default one first. If you want a different account, add a line such as USD = mystore_usd in the merchant account box of that environment. When no account takes the currency, the form shows a friendly message and nothing is charged, so a payment can never land in the wrong currency.

Choose the payment methods

  • Cards are always on. The card number, expiry date and security code are typed into fields that Braintree hosts.
  • PayPal appears when PayPal is linked to your Braintree account. The amount shown in the PayPal window follows the form total as the customer changes quantities.
  • Apple Pay appears on Apple devices with Safari once Apple Pay is switched on in Braintree and your domain is registered there.
  • Google Pay appears in browsers that support it once Google Pay is switched on in Braintree. For Production, enter the merchant id from your Google Pay and Wallet Console.

A method switched on here but not in your Braintree account is simply not shown, so you can turn methods on in Braintree first and here second.

3D Secure 2

3D Secure lets the card’s bank ask the customer to confirm the payment, for example in their banking app. The Drop-in UI runs this step on the form with the total, the email and the billing address you mapped, so the bank sees good data and asks the customer less often. Choose how strict to be:

  • Required for cards (the default). The server asks Braintree to refuse a card payment that did not pass 3D Secure. This is the right choice for customers in Europe, where banks expect strong authentication.
  • Try it. Authentication runs when the card supports it, but a card without it is still charged.
  • Off. No authentication step.

3D Secure must also be switched on for your merchant account in Braintree. The entry shows whether the liability for fraud moved to the card’s bank. Apple Pay and Google Pay cards use the device’s own authentication, and PayPal handles its own checks.

Add a Braintree feed to a form

Open the form, go to Settings, Braintree and click Add New. A feed decides what is charged and when.

The Braintree feed: products and services with the form total, the payment action (charge now or authorize only), billing mapping with the customer email and the feed condition
The feed: charge the form total now, or authorize it and capture later.
  • Transaction type: Products and Services, Donations or Subscription.
  • Payment amount: usually the form total. The amount is always worked out by Gravity Forms on the server; a total typed or changed in the browser is ignored.
  • Payment action: Charge now takes the money at once. Authorize only holds the amount on the card so you can capture it later from the entry, which suits orders you confirm by hand.
  • Billing information: map the email, name, phone and address fields. They help 3D Secure and are saved with Braintree customers for subscriptions.
  • Conditional logic: only charge when a condition is met, for example when a paid option is chosen.

The payment box appears above the submit button. When the customer clicks the button, the Drop-in UI checks the details, runs 3D Secure if needed and hands the add-on a one-time payment token. The add-on then charges the total on the server. If the bank declines the payment, the form shows a clear message under the total, no entry is saved and the customer can try again with another card or method.

A retreat booking form with name, email, billing address, two products and the total, and the payment box with card fields plus PayPal, Apple Pay and Google Pay above the Pay and book button
The form your customer fills in. Card details go to Braintree, never to your website.

Totals are checked twice

Every money request carries a one-time key, so a double click or a network retry never charges twice. After each payment the add-on compares the amount and currency Braintree answered with the entry; if they differ, the payment is cancelled at once and the customer sees a message instead of a wrong charge.

Subscriptions

Subscriptions use the plans you create in the Braintree Control Panel under Subscriptions, Plans. In the feed choose Subscription, pick the plan from the list and choose the recurring amount, usually the form total. The billing frequency and any trial come from the plan; the plan currency must match the form currency.

  • The add-on creates a Braintree customer with the email and name, saves the payment method for repeat charges (verified against the merchant account) and starts the subscription with your recurring amount.
  • A setup fee mapped in the feed is charged once, as its own transaction, before the subscription starts.
  • The number of billing cycles in the feed sets how many times the plan bills; leave it empty to bill until cancelled.
  • Cancel a subscription with the Cancel Subscription button on the entry: it is cancelled in Braintree too.

Webhooks

Webhooks tell your site about events that happen later: monthly subscription charges, failed charges, cancellations, the end of a subscription and disputes. Copy the webhook address from the settings page, then in the Braintree Control Panel open Settings, Webhooks, create a new webhook with that address and tick the Subscription and Dispute notifications. Use Check URL to send a test; the settings page then shows the last verified webhook.

  • Every webhook is checked against your API keys before anything changes, and replays are ignored.
  • Subscription charged adds the payment to the entry once, even if Braintree sends it twice.
  • Charged unsuccessfully marks the subscription Failed; the next successful charge makes it Active again.
  • Cancelled and expired update the entry; past due adds a note.
  • Disputes add a note with the amount and reason and send the Dispute Opened notification, so you can reply in Braintree in time.

Capture, void and refund from the entry

Each paid entry has a Braintree box on the right with the status at Braintree, the transaction id, the payment method, the 3D Secure result and the amounts.

An entry paid through Braintree and partly refunded: the Braintree box with the status, the transaction, the card, 3D Secure result, merchant account, captured and refunded amounts, the refund form and Refresh status
The entry after a partial refund: Braintree details, refund form and Refresh status.
  • Capture an authorized payment, in full or in part, up to the authorized amount.
  • Void an authorization, or a payment Braintree has not settled yet. The customer is not charged.
  • Refund all or part of a settled payment. Each refund form can only be sent once, and the amount can never be more than what is left.
  • Refresh status reads the transaction from Braintree, so captures, voids and refunds made in the Braintree Control Panel show on the entry too.

Braintree settles card payments once a day. Until then the box offers Void instead of Refund. Every action adds a note to the entry and sends the matching Gravity Forms notification if you set one up.

Notifications

In the form’s Notifications you can send e-mails on Payment Completed, Payment Authorized, Payment Refunded, Payment Voided, Subscription Created, Subscription Payment Added, Subscription Payment Failed, Subscription Cancelled, Subscription Expired, Dispute Opened and Dispute Won, Lost or Accepted. Because the payment is taken before the entry is saved, the usual Form is submitted notification already means the customer has paid.

Test before going live

  1. Keep the environment on Sandbox and add a feed to a test form.
  2. Pay with the Braintree test card 4111 1111 1111 1111, any future expiry date and any security code. For 3D Secure use the test cards Braintree lists for 3D Secure 2.
  3. Check that the entry is Paid and shows the transaction id, and that the same transaction is in the Braintree Sandbox Control Panel.
  4. Try a declined test card and confirm the form shows the message and no entry is saved.
  5. Settle the test transaction in the Sandbox Control Panel, click Refresh status and make a partial refund.
  6. Send a test webhook with Check URL and confirm the settings page shows it.
  7. Switch to Production, save the Production keys and make one small real payment that you refund.

Logging and privacy

The add-on uses the Gravity Forms logging tool (Forms, Settings, Logging). Log lines describe what happened, such as a declined payment with its Braintree code, but never contain card numbers, the private key or the authorization header. The entry stores only the card brand, the last four digits and the Braintree ids.

For developers

The filter gravityextra_braintree_transaction lets you add fields of the Braintree TransactionInput, such as a purchase order number or custom fields. The amount, merchant account and order id are set again after the filter, so they always match the entry.

// Add a purchase order number to every Braintree transaction (the amount,
// merchant account and order id are always set by the add-on).
add_filter( 'gravityextra_braintree_transaction', function ( $transaction, $feed, $submission, $form ) {
    $transaction['purchaseOrderNumber'] = 'WEB-' . $form['id'];
    return $transaction;
}, 10, 4 );

The filter gravityextra_braintree_webhook_url changes the webhook address shown in the settings, for example when the site sits behind a proxy, and gravityextra_braintree_dropin_url changes where the Drop-in script is loaded from.

Frequently asked questions

Do card numbers touch my server?

No. The card fields are hosted by Braintree inside the Drop-in UI. Your site only receives a one-time token and charges it on the server.

Which currencies are supported?

Every currency you have a Braintree merchant account for. Amounts are sent with the right number of decimals: none for the Japanese yen, three for the Kuwaiti dinar, two for most others. A total that would need rounding is refused before anything is charged.

Can I take a deposit now and the rest later?

Use Authorize only and capture part of the amount from the entry, or charge the deposit with a separate product field and a second form for the balance.

What happens if the customer closes the page during 3D Secure?

Nothing is charged and no entry is saved. The charge only happens after the Drop-in hands over a token and the form is sent.

Does it work with AJAX forms and multi-page forms?

Yes. The payment box sits on the last page, above the submit button, and works with forms that submit with or without AJAX.

The add-on is available with a 1-site, 5-site or Unlimited licence on the Gravity Forms Braintree Payment Premium Add-on page. Updates and support are included while your licence is active.

Still need help?

Our support team answers tickets every day, usually within a few hours.

0
0
Your Cart
Your cart is emptyReturn to Shop
🔥 FREQUENTLY BOUGHT TOGETHER
Complete Combo & Save 40%!
ITEM IN YOUR CART
Gravity Forms Klaviyo Add-on
$39.00/yr
+
🎁 RECOMMENDED ADD-ON SAVE 40% OFF
Original Price: $39.00/yr
Bundle Special Price: $23.40/yr