The Magento 2 Braintree Silence module suppresses configuration validation errors from the PayPal Braintree payment module when it's disabled or not configured.
When the PayPal Braintree payment module is disabled or not configured, it still attempts to validate its configuration on initialization. This results in error messages like:
merchantId needs to be set
These errors flood your system.log even though the payment method is intentionally disabled, making it harder to identify real issues.
This lightweight module uses a plugin (interceptor) to catch and suppress the specific Braintree configuration errors before they reach your logs. It only silences the merchantId needs to be set error, allowing any real Braintree errors to still be reported if you enable the payment method later.
- Clean Logs: Eliminates unnecessary Braintree configuration errors from system logs
- Surgical Approach: Only suppresses the specific "merchantId needs to be set" error
- Safe: Real errors are still reported if Braintree is enabled
- Version Control Friendly: No need to add dummy data to your database configuration
- Lightweight: Single plugin class with minimal overhead
Install the package via Composer:
composer require siteation/magento2-braintree-silence
bin/magento module:enable Siteation_BraintreeSilenceAlternatively, install by copying the module to your app/code directory:
mkdir -p app/code/Siteation
cp -r path/to/BraintreeSilence app/code/Siteation/
bin/magento module:enable Siteation_BraintreeSilenceNote
This Module requires Magento 2.4 or higher!
For more requirements see the composer.json.
The module registers a plugin on PayPal\Braintree\Model\Adapter\BraintreeAdapter methods (generate and find) that:
- Attempts to execute the original method
- Catches any exceptions thrown
- Checks if the exception message contains "merchantId needs to be set"
- If it matches, returns
nullinstead of throwing the error - If it doesn't match, re-throws the exception (preserving real errors)
app/code/Siteation/BraintreeSilence/
├── Plugin/
│ └── SilenceConfigErrors.php # Plugin interceptor
├── etc/
│ ├── module.xml # Module declaration
│ └── di.xml # Dependency injection configuration
└── registration.php # Module registration
No configuration is required. The module works automatically once enabled.
- Magento 2.4.x (tested with 2.4.8-p3)
- PayPal_Braintree module (any version)
- Compatible with all Magento modes (developer, default, production)
Disabling core Adobe/Magento modules can lead to "Missing dependency" errors if other third-party modules (like advanced checkout extensions or "Pay Later" banners) expect those classes to exist.
This module provides a clean alternative that:
- Keeps the Braintree module enabled but silent
- Avoids dependency issues with third-party extensions
- Lives in version control for consistent environments
- Doesn't require database configuration changes
Contributions are welcome! Please feel free to submit a Pull Request.
This module is licensed under the MIT License. See the LICENSE file for details.
For bugs or feature requests, please create an issue in the repository.
Siteation
- Website: https://siteation.dev/
- Email: info@siteation.dev
Making Magento development cleaner, one module at a time.