This module is no longer maintained. You should not install it on a new Drupal site.
It will not be upgraded to support Drupal 10.
Original description:
Braintree Cashier enables recurring subscriptions by accepting a credit/debit card or PayPal. It requires using the Braintree payment gateway.
With this module you can
- Accept payment by either Credit Card or PayPal.
- Configure which Drupal Roles are granted to purchasers.
- Configure which Drupal Roles are revoked when the subscription has expired.
Features
- Uses the Drop-in UI to collect payment. It is a tokenized payment form provided by Braintree and it ensures that credit card numbers never reach your server. Payment details are sent by the user's browser via JS directly to Braintree, which responds to the user's browser with a unique token representing the payment method that may be used only by your server. The user's browser submits this token to your server, and not the raw payment details.
- Supports any currency supported by Braintree.
- Fixed amount coupon codes.
- PDF invoices for each transaction.
- Uses the Message module to maintain an activity stream for each user to record Braintree Cashier activity. See the Events emitted by this module, most of which are subscribed to by the event subscriber that creates the Braintree Activity stream. Activity that is recorded includes:
- A user created a Drupal account after clicking a link to sign up for a plan.
- A new subscription has been created by successful checkout.
- Payment method updated.
- A Braintree Customer account has been created at Braintree for the Drupal user.
- A user cancels their subscription.
- Prorated plan changes, including changes between the different billing frequencies of monthly to yearly.
- Formats currencies using Money PHP based on the currency code configured at
/braintree-cashier/settings. - Prompts subscribers to optionally provide a reason in a text area for canceling their subscription.
- Includes automated functional tests extending Drupal's
BrowserTestBaseandWebDriverTestBaseclasses. See instructions for running these tests locally. - Supports free trials after collecting a payment method first
- Option to prevent the same payment method from being used by multiple accounts. This attempts to reduce the frequency of multiple free trials by a single individual.
- Sends an email notification about an upcoming charge a configurable number of days prior to the end of a free trial
- Accepting PayPal is a configurable option.
Install this module using composer require drupal/braintree_cashier in order to pick up dependencies, such as the Braintree PHP SDK, Money PHP, and Dom PDF.
This module leans heavily on the Braintree API. There is a minimum of data stored locally in Drupal. For example, when a user visits the "Invoices" tab to see past payments, the data presented there is dynamically generated by an API call to Braintree. Payment history is not stored locally.
Braintree Cashier is inspired by Laravel's Cashier Braintree project and borrows some of it's software architecture. The customer facing UI was inspired by Laracasts.
You must enable Braintree's Advanced Fraud Management to use this module.
Dependencies
- Message
- Token
- Braintree API.
- Money PHP
- Dom PDF
- PHP Dot Env is a developer dependency for running automated functional tests.
- You should make your website accessible only by HTTPS.
Upgrading from 2.x to 4.x
Sites must upgrade first to the latest 3.x version of Braintree Cashier, follow the 3.0 release notes, and then upgrade to 4.x. The machine names of the entity types provided by this module were prefixed with the module name in order to align with Drupal coding standards.
Requirements
- One of the following two configurations:
- PHP 7.2+ and PHP's intl extension. Search for intl in the output of
phpinfo(), or at /admin/reports/status/php, to see if you have this
installed. - If your host does not have the intl extension, then you need PHP 7.2+
and you must runcomposer require symfony/intl, and choose "Force using
the en locale" at/braintree-cashier/settings. These are requirements of Symfony's intl package.
- PHP 7.2+ and PHP's intl extension. Search for intl in the output of
Cron
If running cron using Drush, be sure to include the uri option in order for tokens inserted into the free trial ending notification emails to contain the correct domain. Otherwise, the domain will be http://default. For example, you could run drush as drush core-cron --uri=https://my-domain.com.
Known limitations
- Only one currency may be used by each Drupal installation. This would be the currency of the default Braintree merchant account.
- For plan changes between plans of different billing frequencies, only monthly to yearly is supported. Attempting to change from a yearly plan to monthly, or any other combination of frequencies, will result in an error message.
- A user may have only one active subscription at a time.
- Since a user's address is not explicitly collected, calculating taxes is not supported.
Alternative module
Braintree Cashier is an alternative to Commerce Recurring Framework for recurring billing in Drupal 8.
Sponsorship
This module was developed for use on College Physics Answers.
Project information
Unsupported
Not supported (i.e. abandoned), and no longer being developed. Learn more about dealing with unsupported (abandoned) projectsObsolete
Use of this project is deprecated.- Project categories: E-commerce
4 sites report using this module
- Created by shaundychko on , updated
Stable releases for this project are covered by the security advisory policy.
There are currently no supported stable releases.

