Back

VibeFox Braintree for OpenCart — Help

Requirements

OpenCart: 3.0.x (tested on 3.0.5.0) or 4.0.2 and later (tested on 4.1.0.3).

PHP: 8.0 or later.

Braintree account: you need the Merchant ID, Public Key and Private Key of your Braintree account. They are in the Braintree Control Panel (sandbox: sandbox.braintreegateway.com, live: www.braintreegateway.com) under the gear icon, API, API Keys. Sandbox and live accounts have different keys. 3-D Secure must be enabled for your Braintree merchant account, unless you set 3-D Secure to Disabled. No webhook is needed: card payments are confirmed immediately.

VibeFox license key: bought on vibefox.net. One key works on one domain.

Installation

The download is one zip file with the packages for both OpenCart versions. Unpack it on your computer. It contains README.txt, the OpenCart 3 package wcp_braintree_gateway-oc3-(version).ocmod.zip and the OpenCart 4 package wcp_braintree_gateway.ocmod.zip. Install only the package for your OpenCart version. The license key is the same for both versions.

OpenCart 3

1. In the admin go to Extensions > Installer, click Upload and choose the file wcp_braintree_gateway-oc3-(version).ocmod.zip. The extension has no OCMOD modifications, so Extensions > Modifications does not need a refresh. Instead of the installer you can copy the contents of the upload folder of this package into the root folder of your store.

2. Go to Extensions > Extensions and choose the type Payments. Find VibeFox Braintree Gateway and click Install (the green + button). Your admin user needs the right to modify the payment extensions list.

3. Click Edit (the pencil button) to open the settings page. Paste your VibeFox license key into License key in the license block at the top of the page and click Activate (see License key).

4. Copy the Merchant ID, Public Key and Private Key from the Braintree Control Panel into the sandbox or live fields.

5. Turn on Enable/Disable and click Save. Keep Sandbox mode on and place a test order with a Braintree sandbox test card such as 4111 1111 1111 1111. Then enter the live credentials and turn off Sandbox mode to take real payments.

OpenCart 4

1. In the admin go to Extensions > Installer, click Upload and choose the file wcp_braintree_gateway.ocmod.zip. Do not rename the file: OpenCart 4 takes the extension code from the file name, and a renamed package does not work.

2. The package appears in the list of installed extensions on the same page. Click Install (the green + button) next to it.

3. Go to Extensions > Extensions and choose the type Payments. Find VibeFox Braintree Gateway, click Install (the green + button), then Edit (the pencil button).

4. Enter the license key and the Braintree credentials and test the payment as in steps 3 to 5 for OpenCart 3. The settings page and its fields are the same in both versions.

A new install starts with the payment method turned off and sandbox mode on.

Configuration

All settings are on the extension page: Extensions > Extensions > Payments > VibeFox Braintree Gateway > Edit. The sections are listed on the left; the Save button under the list saves the whole page. When the payment method is enabled but the Merchant ID, Public Key or Private Key of the selected environment is missing, the page warns you that the payment method is hidden at checkout until they are filled in. While sandbox mode is on, the page shows Sandbox mode is on: test payments, no real money. Without the right to modify the extension the page shows the settings but cannot save them.

When you save, Title must have 1 to 128 characters, Sort Order must be a whole number and Total a number of 0 or more. If any field has an error, nothing is saved and the page names the field.

Braintree

Enable/Disable: turns Braintree card payments on or off. The payment method is hidden at checkout until the Merchant ID, Public Key and Private Key of the selected environment are filled in. Default: off.

Title: the payment method name customers see at checkout. It is also the payment method name stored in the order. Default: Credit / debit card. Required, up to 128 characters.

Description: the text shown to the customer at the Confirm Order step, above the card form. Default: Pay securely with your credit or debit card via Braintree.

Sort Order: the position of Braintree among the payment methods at checkout. Leave it empty or enter a whole number.

Geo Zone: offer Braintree only for payment addresses in the selected geo zone. Default: All zones. Geo zones are set up in System > Localisation > Geo Zones.

Total: the checkout total, in the default currency of the store, that an order must reach before Braintree is offered. Leave it empty to offer Braintree for any total.

API credentials

Log in to the Braintree Control Panel (sandbox or live, linked in this section), click the gear icon, then API and API Keys. The public and private keys are listed there, and the Merchant ID is shown on the same page. The page shows only the credential fields of the selected environment; both sets stay saved.

Sandbox mode: uses the Braintree sandbox (test payments, no real money). Default: on. Turn it off to take real payments with the live credentials. Refunds, captures and voids always use the environment the order was paid in. While it is on, customers see SANDBOX / TEST MODE — no real money is charged. at the Confirm Order step.

Sandbox Merchant ID and Live Merchant ID: the Merchant ID of the sandbox or live account.

Sandbox Public Key and Live Public Key: the public key of that account.

Sandbox Private Key and Live Private Key: the private key of that account, saved exactly as entered. Saved private keys are never shown again. The field stays empty and shows Saved — leave empty to keep it. Type a new value only to change it. To remove a saved key, tick Clear the saved key on save under the field and click Save.

Sandbox merchant account ID(s) and Live merchant account ID(s): optional. Braintree charges in the currency of the merchant account. Leave empty to use your default merchant account, enter one ID (for example mystore_EUR) or one per currency: EUR=mystore_EUR, USD=mystore_USD. If the charged currency does not match the order currency, the transaction is voided automatically and the customer is not charged.

Payment

Transaction type: how the card is charged.

Sale — charge immediately: the order is paid at once (default).
Authorize only — capture later: the order gets the Authorized Status (not paid). Capture or void it in the VibeFox Braintree Gateway tab of the order page. Authorizations expire after about 7–30 days depending on the card.

3-D Secure: 3-D Secure 2 (Strong Customer Authentication) is mandatory for most card payments in the EEA and UK. It must also be enabled for your Braintree account (contact Braintree support if payments fail with a 3-D Secure configuration error).

Enabled — verify cards, block failed authentications: the default. The customer completes the bank's verification; a failed authentication is blocked before the card is charged.
Required — only accept payments with liability shift: payments without a successful 3-D Secure authentication are refused, and Braintree also enforces it on the server side.
Disabled: no 3-D Secure check.

The 3-D Secure result is checked on the server, not only in the browser, before the card is charged.

Orders

OpenCart creates the order at the Confirm Order step without a status (a missing order). It gets a status only after Braintree has accepted the card payment. A declined card leaves the order without a status and the customer stays on the confirm step. Each field below lists your OpenCart order statuses.

Order Status After Payment: a sale was captured, or an authorization was captured on the order tab. Default: Processing.

Authorized Status: authorize only: the amount is reserved, not paid yet. Default: Pending, because OpenCart has no On hold status; the order note and the order tab explain it. You can create your own status in System > Localisation > Order Statuses and select it here.

On Hold (Review) Status: Braintree returned an unexpected transaction status, or the charged amount or currency did not match and the automatic void failed. A note explains what to check. Default: Pending.

Voided Status: the authorization was voided on the order tab and the held amount is released. Default: Canceled.

Refunded Status: the payment is fully refunded, or voided as a full refund before settlement. Partial refunds only add a note. Default: Refunded.

Advanced

Debug log: also logs API calls and payment steps to wc_btg_debug.log.php in the OpenCart logs folder (storage/logs). The file cannot be opened from the web. Errors are always logged, even when this is off. The log never contains API keys, card or customer data. Default: off.

Log: shows the size and the latest entries of the log. Click Clear log to empty it.

Delete data on uninstall: when on, uninstalling the extension removes the gateway settings and the log. Braintree transactions and refunds always stay, so orders paid before can still be refunded, captured or voided after a re-install. Default: off.

Import / Export

Export: Download JSON saves the settings as a JSON file. Private keys are not exported.

Import: paste previously exported JSON and click Import to restore the settings. Saved private keys are kept.

Checkout

At the Payment Method step the customer chooses the payment method (by default Credit / debit card). At the Confirm Order step the customer sees your description and the Braintree card form, loaded from Braintree in the language of the storefront. OpenCart creates the order at this step, still without a status. When the customer clicks Confirm Order, the form checks the card and, with 3-D Secure on, the customer completes the bank's verification; the order total, e-mail and billing address are passed to it. Only a one-time token reaches your store. On OpenCart 4 the customer picks the payment method with the Choose button of the payment method block, in the window Payment method options. The card form then appears in the confirm block at the bottom of the checkout page, above the Confirm Order button. If the store does not ask for a payment address (the OpenCart 4 default), the 3-D Secure check gets the shipping address instead.

The extension then charges the token through the Braintree API for the order total in the order currency, with the OpenCart order number as the order ID in Braintree. The charged amount and currency are checked against the order. The order gets its status only after Braintree accepts the payment, the standard OpenCart way, with the usual order e-mails and stock update. The cart is emptied and the customer sees the OpenCart order success page.

If the payment fails, the order stays without a status, a note with the reason is added to the order, and the customer stays at the Confirm Order step with a message, for example Your card was declined. Please use another card or contact your bank., 3-D Secure authentication failed. Please try again or use another card. or The card security code or billing address could not be verified. Please check your details and try again. The customer can enter the card again and retry at once. If the charged currency or amount does not match the order, the transaction is voided and the customer sees This payment could not be processed in the currency of your order. Your card has not been charged. Please choose another payment method or contact us.

An order is never charged twice. A second submit while the payment is running shows This order is already being paid. Please wait a moment and check your e-mail before trying again. A repeated confirm of a paid order goes straight to the success page; for an authorized payment it shows A payment for this order has already been received and is awaiting review. If the card was charged but OpenCart could not set the order status, the customer sees Your payment was received, but the order could not be completed automatically. Please contact us — do not pay again. The next attempt with the same cart sets the status of that order from the saved transaction without charging again. OpenCart 3 creates a new order each time the Confirm Order step is shown, so one cart can have several orders (OpenCart 4 keeps one order for the checkout and updates it, so after a declined card the customer pays the same order): once one of them is paid, another order of the same cart is not charged, and the customer sees This cart has already been paid with order #…. Please check your order history — do not pay again.

OpenCart 4 keeps the order in the checkout until the success page is shown. If that order was closed by the store meanwhile (for example cancelled, voided or refunded), or it is already paid and the cart has changed since (other products or quantities), Confirm Order sends the customer back to the checkout, which makes a new order of the cart with its own payment. The same cart submitted twice still goes to the success page without a second charge.

The extension takes card payments only. It has no saved cards, no subscriptions or recurring payments, no PayPal, Venmo, Apple Pay, Google Pay or local payment methods, and no Braintree webhooks.

Orders and refunds

Order statuses

No status (missing order): the payment has not been made or was declined. In Sales > Orders such orders are shown only with the filter Order Status set to Missing Orders.

Order Status After Payment (default Processing): the card was charged (Sale), or an authorization was captured. A note shows the amount, the Braintree transaction ID and the 3-D Secure result.

Authorized Status (default Pending): the funds are only authorized (Authorize only). A note asks you to capture the payment on the order page before shipping.

On Hold (Review) Status (default Pending): Braintree returned an unexpected transaction status, or a charge in the wrong currency or amount could not be voided automatically. The note explains what to check in the Braintree Control Panel.

Voided Status (default Canceled): an authorization was voided.

Refunded Status (default Refunded): the payment was fully refunded through the extension.

Notes are entries in the order History that the customer does not see.

VibeFox Braintree Gateway tab

In Sales > Orders open an order paid with Braintree. At the bottom of the order page, next to History and Additional, the VibeFox Braintree Gateway tab shows the Transaction ID (linked to the transaction in the Braintree Control Panel of its environment) with a Sandbox label for sandbox payments, the transaction Status, the Amount and merchant account, the 3-D Secure result, the amounts Charged / refunded, the capture, void and refund buttons, the refund history and the Braintree notes of the order. The tab is shown to users who have access to the extension; the buttons need the right to modify it (set in System > Users > User Groups).

Capture and void

For an authorized payment, click Capture Braintree payment to charge the order total, or Void Braintree authorization to release the held amount and cancel the order. Capture sets the order to Order Status After Payment; void sets it to Voided Status. If the action fails, the error is shown in the tab and added to the order notes.

Refunds

In the VibeFox Braintree Gateway tab enter the Amount (the amount not refunded yet is filled in), optionally a Reason (optional), and click Refund via Braintree. Confirm the question Refund this amount through Braintree? This cannot be undone. Full and partial refunds are supported, for a captured payment and for a payment on review. Refunds are made in the amount and currency Braintree charged. Braintree refunds only settled transactions, usually within 24 hours. Before settlement a full refund is done as a void; a partial refund then fails with a message to wait for settlement. The refund is sent to the environment (sandbox or live) of the payment, so the credentials of that environment must be set. If Braintree does not accept the refund, the tab shows the error and no refund is recorded. A successful refund is added to the refund history and the notes. A full refund sets the order to Refunded Status; a partial refund does not change the status. Status changes from the tab do not notify the customer and do not return products to stock, like a manual status change.

Product returns in Sales > Returns do not send money back through Braintree. Disputes (chargebacks), settlement declines and refunds made in the Braintree Control Panel are not synced to OpenCart.

License key

The extension works with a VibeFox license key from vibefox.net. The license block License — VibeFox Braintree Gateway is the first block on Extensions > Extensions > Payments > VibeFox Braintree Gateway > Edit, above the settings. Paste the key into License key and click Activate. After that the block shows the key masked, the status (for example the date the license is active until and your domain) and the buttons Check now to check the status again, Change key to enter another key and Remove key to remove the key from this store. Below them are the line Product: opencart-payment-braintree and the link Manage licenses and domains in your account, which opens your vibefox.net account. Only admin users with the Modify permission for the extension can change the key. The texts of the block follow the admin language (English and Russian are included).

If the key is not accepted, the block says why, for example Key not found, This key belongs to another product, Domain limit reached or License expired on a date. After the store address changes, or after you free a domain slot in your account, click Check now. If the license server cannot be reached, the extension keeps working on the last known status.

One key works on one domain: the store address from the OpenCart configuration. Removing the key from the store does not free its domain slot. Free the slot in your vibefox.net account.

Without an active key, Braintree is not shown to customers at checkout. If a payment is started anyway, the customer sees This payment method is not available. Please choose another one. An admin user who is logged in to the admin in the same browser still sees the payment method in the store, marked (unlicensed — visible to admins only), so you can set up and test the extension before you buy a key. On OpenCart 4 this preview is not available: the store does not see the admin login, so without an active key the payment method is hidden for everybody. After you have opened the Edit page once, a reminder appears on the admin Dashboard. Close it with × to hide it for 7 days. Existing orders are not affected: payments already started are still confirmed, and captures, voids and refunds work.

When a license expires, the extension keeps working, but updates and support need a renewal. The status is checked again automatically when you open the admin Dashboard or the Edit page: once a day for the first 14 days after the key is entered, then once a week. No cron job is needed. Uninstalling the extension always removes the license key and license status.

Troubleshooting

Braintree does not appear at checkout: check that the license is active, Enable/Disable is on and the selected environment has a Merchant ID, Public Key and Private Key. The settings page shows a warning when a key is missing. Also check that the payment address is in the selected Geo Zone and that the order reaches the Total set in the settings.

The card was charged, but the order stays without a status: card payments are confirmed immediately, without a webhook. Look at the notes of the order and the Log field on the extension page. If a note says that the answer from Braintree was lost, check the Braintree Control Panel for a transaction with this order number before accepting another payment. If the status could not be set after the charge, the next payment attempt with the same cart sets it without charging again.

The card form shows Could not initialize payment form: the keys of the selected environment are wrong, or the merchant account ID does not exist in that account. Check the keys and the merchant account ID(s), then reload the page.

The customer sees Your session has expired. Please refresh the page and try again.: the checkout session changed while the form was open. The customer reloads the checkout page.

3-D Secure fails for every payment: 3-D Secure must be enabled for your Braintree merchant account. Contact Braintree support, or set 3-D Secure to Disabled (not recommended in the EEA and UK, where SCA is mandatory).

The customer is told the payment could not be processed in the currency of the order: Braintree charged in the currency of the merchant account. Enter the merchant account ID for the order currency in the merchant account field of the current environment.

The customer sees The order total must be greater than zero to pay by card.: the order total is zero, for example after a voucher. Such orders cannot be paid by card.

A partial refund fails right after the payment: Braintree can only refund settled transactions, usually within 24 hours. Refund the full amount to void the transaction now, or make the partial refund after settlement.

No buttons in the tab, or a message about the environment: your user group has no right to modify the extension, or the payment was made in the sandbox or live environment and the credentials of that environment are not set. Enter them and try again.

Uninstall

Go to Extensions > Extensions, choose the type Payments and click Uninstall (the red − button) next to VibeFox Braintree Gateway. The license key and license status of this extension are always removed. OpenCart always removes its own settings of the extension: Enable/Disable, Sort Order, Geo Zone, Total and the order statuses of the Orders section, which return to their defaults on a re-install. If Delete data on uninstall is on, the other gateway settings (title, description, sandbox mode, credentials, merchant accounts, transaction type, 3-D Secure, debug log) and the log are removed. If it is off, they are kept for a later re-install. The Braintree transactions and refunds are always kept, so orders paid before can still be refunded, captured or voided after a re-install. Existing orders keep their payment notes.

On OpenCart 4, to remove the files of the extension as well, go to Extensions > Installer after the uninstall and click Uninstall (the orange − button) next to VibeFox Braintree Gateway in the list of installed extensions, then Delete (the red bin button) to remove the uploaded package.

Braintree is a trademark of its respective owner. This extension is not affiliated with or endorsed by Braintree.