diff --git a/community-patches.json b/community-patches.json index eaca0758..1a63cec7 100644 --- a/community-patches.json +++ b/community-patches.json @@ -65,5 +65,18 @@ } } } + }, + "magento/magento2/40622": { + "categories": [ + "Payments" + ], + "title": "PayPal Braintree: avoid INSTANTIATION_OPTION_REQUIRED when clientToken is missing (cart PayPal button JS). Author: @Genaker. See magento/magento2#40622.", + "packages": { + "magento/magento2-base": { + "2.4.8": { + "file": "community/magento_magento2_40622_braintree_paypal_button.patch" + } + } + } } -} \ No newline at end of file +} diff --git a/patches/community/magento_magento2_40622_braintree_paypal_button.patch b/patches/community/magento_magento2_40622_braintree_paypal_button.patch new file mode 100644 index 00000000..39f265cf --- /dev/null +++ b/patches/community/magento_magento2_40622_braintree_paypal_button.patch @@ -0,0 +1,12 @@ +--- a/vendor/paypal/module-braintree-core/view/frontend/web/js/paypal/button.js 2026-03-24 00:04:41.716453736 -0700 ++++ b/vendor/paypal/module-braintree-core/view/frontend/web/js/paypal/button.js 2026-03-24 00:04:41.736453720 -0700 +@@ -180,6 +180,9 @@ + * @param buttonConfig + */ + loadSDK: function (buttonConfig) { ++ if (!buttonConfig || !buttonConfig.clientToken) { ++ return; ++ } + // Load SDK + braintree.create({ + authorization: buttonConfig.clientToken