magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.53k stars 9.31k forks source link

PayPal Express Checkout button is not displayed with PayPal Braintree by Gene #29243

Closed sergey-ctrl closed 3 years ago

sergey-ctrl commented 4 years ago

Preconditions (*)

1.Magento ver. 2.4.0-beta2 2.Configure PayPal Express Checkout payment method https://i.imgur.com/PDenw9M.png 3.Configure Braintree Payments (by GENE Commerce), Enable PayPal through Braintree https://i.imgur.com/9qBDM3i.png

Steps to reproduce (*)

  1. Go to Checkout, step 2

Expected result (*)

  1. The PayPal Express Checkout button is displayed

Actual result (*)

  1. The PayPal Express Checkout button is not displayed https://i.imgur.com/W38YRDZ.png

Please provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.

m2-assistant[bot] commented 4 years ago

Hi @sergey-ctrl. Thank you for your report. To help us process this issue please make sure that you provided the following information:

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

@magento give me 2.4-develop instance - upcoming 2.4.x release

For more details, please, review the Magento Contributor Assistant documentation.

Please, add a comment to assign the issue: @magento I am working on this


:clock10: You can find the schedule on the Magento Community Calendar page.

:telephone_receiver: The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, please join the Community Contributions Triage session to discuss the appropriate ticket.

:movie_camera: You can find the recording of the previous Community Contributions Triage on the Magento Youtube Channel

:pencil2: Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel

sergey-ctrl commented 4 years ago

A month has passed, is there any information?

namluu commented 4 years ago

Do you have any updates on this, please?

jsamhall commented 3 years ago

@namluu @sergey-ctrl Like you I have been waiting for an update on this important problem, so I thought you might appreciate what I found.

We have encountered this problem in our live web store where we wish to use Braintree to process credit cards, and PayPal Express Checkout as another payment option, and specifically NOT using Braintree for PayPal.

I found that when PayPal Express and Braintree Card Payments are both enabled, the window.paypal version conflict / already defined error occurs.

I found that /vendor/paypal/module-braintree-core/view/frontend/web/js/view/payment/adapter.js specifies https://www.paypalobjects.com/api/checkout.js as a RequireJS dependency, therefore this remote file is fetched and executed regardless of whether or not "Enable PayPal through Braintree" is set to "YES" in Braintree system configuration (therefore, it is needless overhead as Braintree CC processing does not require PayPal SDK). As you will see by viewing that file, it is responsible for assigning window.paypal and specifies version 4.0.318.

Continuing on with my investigation and findings, when PayPal Express Checkout is enabled as a Payment Method, vendor/magento/module-paypal/view/frontend/web/js/in-context/paypal-sdk.js is loaded and retrieves the PayPal JS SDK from paypal.com/sdk/js?client-id=.....params which loads the PayPal JS SDK at version 5.0.186 (at least at the time of writing)

As a means of proving my theory, I simply removed the https://www.paypalobjects.com/api/checkout.js from /vendor/paypal/module-braintree-core/view/frontend/web/js/view/payment/adapter.js, enabled PayPal Express Checkout, and proceeded to checkout. As I expected, version 5.0.186 of the PayPal JS SDK is successfully loaded and the Braintree Credit Card Form functions perfectly alongside the PayPal Express Checkout method.

There are various ways in which you can address this problem for your own store, so I'll defer that decision to you. I hope this information helps you make that decision!

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 14 days if no further activity occurs. Is this issue still relevant? If so, what is blocking it? Is there anything you can do to help move it forward? Thank you for your contributions!

jsamhall commented 3 years ago

AFAIK this issue has yet to be resolved and therefore should not be marked as stale.

Kishorchhugani commented 2 years ago

https://drops.meetanshi.com/suokfl

I am Facing Same issue while using paypal braintree and paypal Express Checkout