Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to checkout with PayPal through Braintree #37242

Closed
1 of 5 tasks
n2diving-dgx opened this issue Mar 20, 2023 · 82 comments
Closed
1 of 5 tasks

Unable to checkout with PayPal through Braintree #37242

n2diving-dgx opened this issue Mar 20, 2023 · 82 comments
Labels
Area: Admin UI Component: Braintree Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Priority: P0 This generally occurs in cases when the entire functionality is blocked. Progress: done Reported on 2.4.6 Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch

Comments

@n2diving-dgx
Copy link

Preconditions and environment

Upon upgrading our production site from M2.4.5-p2 to M2.4.6 we discovered customers were unable to checkout via PayPal through Braintree.

We were unable to find any workaround.

Building Magento 2.4.6
+ cat /etc/centos-release
CentOS Linux release 7.9.2009 (Core)
+ /usr/local/apache/bin/httpd -v
Server version: Apache/2.4.46 (Unix)
Server built:   Jun 16 2021 21:29:21
+ mysql -V
mysql  Ver 8.0.28 for Linux on x86_64 (MySQL Community Server - GPL)
+ php -v
PHP 8.1.17 (cli) (built: Mar 17 2023 09:39:39) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.17, Copyright (c) Zend Technologies
    with Zend OPcache v8.1.17, Copyright (c), by Zend Technologies
+ php /usr/local/bin/composer -V
Composer version 2.3.5 2022-04-13 16:43:00

Steps to reproduce

Fresh Install of M2.4.6 in environment as above
Open browser "incognito" window using Windows 11 and Google Chrome
Login to Magento admin backend

Nav to Admin>Stores>Configure>General>Web>Default Cookie Settings
If necessary, set the Cookie Domain to the appropriate domain value (so Demo Customer will be able to login on front end)
Save Config
Nav to Admin>Stores>Configure>Sales>Payment Methods
Select Merchant Country as United States and Save Config
Configure Braintree Payments (by GENE Commerce v4.5.0)
Enter known valid sandbox credentials for Merchant ID, Public Key, Private Key and Validate Credentials
In the Enable PayPal through Braintree section...
Set Enable PayPal through Braintree = Yes
Set Display on Shopping Cart = Yes
Save Config
Flush Magento Cache

Open separate tab on incognito browser and navigate to frontend
Successfully Sign In using Demo Customer Access credentials
Click Add-to-Cart for Affirm Water Bottle (or anyother product)
Observe "spinner" remains over count box in upper right hand corner of page and does not clear
NO message "You added the Affirm Water Bottle to your shopping cart." appears
Clicking cart icon displays "You have no items in your shopping cart"
Add-to-Cart two or three more times for the Affirm Water Bottle
Click the Luma Store icon to return to home page
[ Although the website is not hung, it's useless because nothing can successfully added to cart,
this behavior appears to be related to the PayPal button appearing in the mini-cart ]

Return to backend
Nav to Admin>Stores>Configure>Sales>Payment Methods
Configure Braintree Payments (by GENE Commerce v4.5.0)
In the Enable PayPal through Braintree section
Set Display on Shopping Cart = No
Save Config
Flush Magento Cache

Return to frontend
You should still be on the Luma store home page
Use your web browser "refresh" function to reload the page
The green circle with the check mark and the message "You added the Affirm Water Bottle to your shopping cart." appears several times.
The count box in the upper right corner will now equal the number of times add-to-cart was previously clicked.
Click the cart icon and Proceed to Checkout
Shipping Method select Fixed Flat Rate
Payment Method select PayPal
Click the large yellow PayPal button
Rarely, the PayPal "modal box" zooms out surrounded by dark background, and remains open as normal,
If the PayPal modal box remains open, close it and add another item to cart then Proceed to Checkout again
In most tests the modal box zooms out for a moment and closes, then
Message "PayPal Checkout could not be initialized. Please contact store owner." appears.
and you are unable to proceed to place an order.

Expected result

During checkout upon selecting PayPal as the Payment Method then clicking the large yellow PayPal button the PayPal modal box appears and the customer is able to successfully make payment and checkout.

Actual result

During checkout upon selecting PayPal as the Payment Method then clicking the large yellow PayPal button the PayPal modal box appears for a moment before automatically closing and the customer is unable to make payment or complete the order.

Additional information

Tested with both our sandbox and production Braintree creditials, in both production and development environments, PayPal as payment method is essentially not functional although for some reason under certain unknown circumstances it will work as expected for a specific customer checkout. It did work as expected on M2.4.5-p2

I was unable to find any workaround and the PayPal payment method is currently disabled on our M2.4.6 production website.

Release note

No response

Triage and priority

  • Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.
@m2-assistant
Copy link

m2-assistant bot commented Mar 20, 2023

Hi @n2diving-dgx. Thank you for your report.
To speed up processing of this issue, make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue:


Join Magento Community Engineering Slack and ask your questions in #github channel.
⚠️ According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.
🕙 You can find the schedule on the Magento Community Calendar page.
📞 The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, join the Community Contributions Triage session to discuss the appropriate ticket.

@m2-assistant
Copy link

m2-assistant bot commented Mar 20, 2023

Hi @engcom-November. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: 👇

  • 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue.
  • 3. Add Area: XXXXX label to the ticket, indicating the functional areas it may be related to.
  • 4. Verify that the issue is reproducible on 2.4-develop branch
    Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!
  • 5. Add label Issue: Confirmed once verification is complete.
  • 6. Make sure that automatic system confirms that report has been added to the backlog.

@engcom-November engcom-November added the Reported on 2.4.6 Indicates original Magento version for the Issue report. label Mar 20, 2023
@n2diving-dgx
Copy link
Author

n2diving-dgx commented Mar 20, 2023

After consultation, I have learned that the Braintree V4.5.0 module in M2.4.6 includes new functionality and is now passing individual cart line items to PayPal. Previously, the Braintree V4.4.0 version in M2.4.5 and earlier did NOT pass cart line items to PayPal just the Grand Total amount on the order. However, there is an issue in that when the cart line items do not add up to the Grand Total, for example if there is a separate sales tax line item, then PayPal through Braintree will fail as a payment method on checkout, the modal box will automatically close and Magento will display an error message to the customer "PayPal Checkout could not be initialized."

There is a configuration option found under Advanced Braintree Settings for Send Cart Line Items, which defaults to Yes. Setting "Send Cart Line Items" = NO does allow the PayPal login modal box to zoom out and remain... it is possible to login to PayPal using the modal box, but upon clicking the "Complete Purchase" button, the modal box closes and returns to the Magento checkout flow where a pink box declares "Something went wrong with your request. Please try again later." simultaneously an error for "Call to undefined method..." is logged in exception.log file.

** main.CRITICAL: Error: Call to undefined method Magento\Sales\Api\Data\OrderExtension::getGwBasePrice() in /www/releases/vendor/paypal/module-braintree-core/Gateway/Request/Level23ProcessingDataBuilder.php:188 **

As of now, there is no workaround that allows checkout using PayPal through Braintree on M2.4.6

Screenshot 2023-03-21 052308

@Rich07082
Copy link

same issue, thought it was just related to the PayPal buttons (was getting error when trying to add to cart) and on the cart page when PayPal through Braintree was enabled and display on shopping cart was enabled.

Was able to duplicate error when using paypal as a checkout method.

@engcom-Bravo engcom-Bravo self-assigned this Mar 28, 2023
@m2-assistant
Copy link

m2-assistant bot commented Mar 28, 2023

Hi @engcom-Bravo. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: 👇

  • 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue.
  • 3. Add Area: XXXXX label to the ticket, indicating the functional areas it may be related to.
  • 4. Verify that the issue is reproducible on 2.4-develop branch
    Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!
  • 5. Add label Issue: Confirmed once verification is complete.
  • 6. Make sure that automatic system confirms that report has been added to the backlog.

@m2-assistant
Copy link

m2-assistant bot commented Mar 28, 2023

Hi @engcom-Dash. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: 👇

    1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
    1. Verify that issue has a meaningful description and provides enough information to reproduce the issue.
    1. Add Area: XXXXX label to the ticket, indicating the functional areas it may be related to.
    1. Verify that the issue is reproducible on 2.4-develop branch
      Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
      - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
      - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

@engcom-Dash
Copy link
Contributor

Hi @n2diving-dgx ,

Verified the issue in 2.4.6- Magento instance and the issue is reproducible,Hence we are confirming the issue.Kindly Refer the Screenshots.

Preconditions:
Magento version 2.4.6
PHP 8.1
Braintree Payment Module Configured.

Steps to reproduce:
As per given main description Steps

Braintree configuration
pay3
Display on Shopping Cart is YES
pay4
Display on Shopping Cart is NO
pay1
pay2

Here attached the video reference placing the order with paypal:

paypal.mp4

We are getting actual result as per the description ,Hence we are confirming the issue in 2.4.6-develop instance.

Regards,

@engcom-Dash engcom-Dash added Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Component: Braintree Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Area: Admin UI labels Mar 29, 2023
@github-jira-sync-bot
Copy link

✅ Jira issue https://jira.corp.adobe.com/browse/AC-8386 is successfully created for this GitHub issue.

@m2-assistant
Copy link

m2-assistant bot commented Mar 29, 2023

✅ Confirmed by @engcom-Dash. Thank you for verifying the issue.
Issue Available: @engcom-Dash, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

@engcom-Hotel engcom-Hotel added the Priority: P0 This generally occurs in cases when the entire functionality is blocked. label Mar 31, 2023
@Cupropituvanso
Copy link

We have the same issue and opened another issue.
I had closed the other issue, but we have also postet the error log of the server, maybe this could be interesting: #37325

@live4soccer7
Copy link

I can confirm on a stock checkout that paypal does NOT work with braintree. beyond frustrating.

@live4soccer7
Copy link

live4soccer7 commented Oct 21, 2023

I can also confirm this change does not work either on p3:

Line 135 (after $order = $paymentDO->getOrder();) we added:

$shouldSubtractTax = $this->scopeConfig->getValue(\Magento\Tax\Model\Config::XML_PATH_DISPLAY_SALES_PRICE, ScopeInterface::SCOPE_STORE, $order->getStoreId()) == \Magento\Tax\Model\Config::DISPLAY_TYPE_INCLUDING_TAX;

and line 162 (after $itemQuantity = (float)$item->getQtyOrdered();) we changed the line to:

$itemUnitPrice = $shouldSubtractTax ? ((float)$item->getPrice() - (float)$item->getTaxAmount()) : (float)$item->getPrice();

Result:
An error has happened during application run. See exception log for details.

#72 {main} {"exception":"[object] (Error(code: 0): Call to undefined method Magento\Sales\Api\Data\OrderExtension::getGwBasePrice() at vendor/paypal/module-braintree-core/Gateway/Request/Level23ProcessingDataBuilder.php:191)"} []

This still resolves the issue and everything seems to be working. So still some good bugs somewhere with the GW feature. Come on BrainTree/Gene, fix this. It is getting old having to go through these issues every single update.

Commenting out lines 186-189 & 198-232 allows PayPal via Braintree to process without errors
Tried commenting out lines 186-232 in Level23ProcessingDataBuilder.php but this left an error with undefined variable $baseCustomerBalAmountUsed (to do with store credits but never use them).

Have now left lines 192-195 in and payments are processing okay.

@adriansanta
Copy link

@live4soccer7 we actually had to change a bit the initial solution, because for cart items with quantity greater than 1 it would still fail. not sure if that's what you experience but here's what we changed:

$itemUnitPrice = $shouldSubtractTax ? ((float)$item->getPrice() - (float)$item->getTaxAmount()) : (float)$item->getPrice();
->
$itemUnitPrice = $shouldSubtractTax ? ((float)$item->getRowTotal() - (float)$item->getTaxAmount()) / $itemQuantity : (float)$item->getPrice();

looking forward to an official fix for this

@adriansanta

This comment was marked as outdated.

@live4soccer7
Copy link

I also had to disable captcha v2 again. I'm on 2.4.6-p3. CC could not go through. I implemented the resolution I stated above and I had seen that the captcha issue was resolved. It is not, at least with the resolution that was implemented in my post.

@mohitnavik
Copy link

mohitnavik commented Dec 29, 2023

I have upgraded Magento version from 2.4.5-p2 to 2.4.6-p3 and I am also getting the same error:

report.CRITICAL: Error: Call to undefined method Magento\Sales\Api\Data\OrderExtension::getGwBasePrice() in vendor/paypal/module-braintree-core/Gateway/Request/Level23ProcessingDataBuilder.php

Is there any patch or fixes available?

Thanks in advance!

@LucScu
Copy link

LucScu commented Jan 2, 2024

I have upgraded Magento version from 2.4.5-p2 to 2.4.6-p3 and I am also getting the same error:

report.CRITICAL: Error: Call to undefined method Magento\Sales\Api\Data\OrderExtension::getGwBasePrice() in vendor/paypal/module-braintree-core/Gateway/Request/Level23ProcessingDataBuilder.php

Is there any patch or fixes available?

Thanks in advance!

same issue on 2.4.6-p3, then installed the suggested patch https://support.gene.co.uk/support/solutions/articles/35000227790-patch-for-unable-to-checkout-via-paypal-through-braintree-in-magento-v2-4-6-and-v2-4-6-p1-p2 and setted under Advanced Braintree Settings for "Send Cart Line Items" to NO, now it works.

@Calvin495
Copy link

Thank you everyone for your feedback!

GENE Commerce is responsible for developing the Magento Braintree extension. I would like to tell you that this issue is already been fixed in Magento v2.4.7-beta1 that has already been released on June 13, 2023. Here, you can find the v2.4.7-beta1 release notes for the Braintree: https://experienceleague.adobe.com/docs/commerce-operations/release/notes/adobe-commerce/2-4-7.html?lang=en#braintree

We already have a patch ready for Magento/Adobe v2.4.6 and its patch versions for the issue reported here. You can download the patch from this link: https://support.gene.co.uk/support/solutions/articles/35000227790-patch-for-unable-to-checkout-via-paypal-through-braintree-in-magento-v2-4-6-and-v2-4-6-p1-p2

Also if you have any technical issues or concerns regarding our Magento Braintree extension, you can reach out to us by raising a support ticket from here: https://support.gene.co.uk/support/home

When I opened the link it only has patch for v2.4.6 and v2.4.6-p1/p2. Do you have separate patch for 2.4.6-p3 or Can we use the same patch for p3 as well?

@LucScu
Copy link

LucScu commented Jan 15, 2024

Thank you everyone for your feedback!
GENE Commerce is responsible for developing the Magento Braintree extension. I would like to tell you that this issue is already been fixed in Magento v2.4.7-beta1 that has already been released on June 13, 2023. Here, you can find the v2.4.7-beta1 release notes for the Braintree: https://experienceleague.adobe.com/docs/commerce-operations/release/notes/adobe-commerce/2-4-7.html?lang=en#braintree
We already have a patch ready for Magento/Adobe v2.4.6 and its patch versions for the issue reported here. You can download the patch from this link: https://support.gene.co.uk/support/solutions/articles/35000227790-patch-for-unable-to-checkout-via-paypal-through-braintree-in-magento-v2-4-6-and-v2-4-6-p1-p2
Also if you have any technical issues or concerns regarding our Magento Braintree extension, you can reach out to us by raising a support ticket from here: https://support.gene.co.uk/support/home

When I opened the link it only has patch for v2.4.6 and v2.4.6-p1/p2. Do you have separate patch for 2.4.6-p3 or Can we use the same patch for p3 as well?

i used it on 2.4.6-p3 and works well.

@neha023
Copy link

neha023 commented Jun 5, 2024

I am using M2.4.7 open source and still found the issue as I am unable to checkout using paypal through braintree.

@live4soccer7
Copy link

@neha023 What errors are you seeing?

@neha023
Copy link

neha023 commented Jun 5, 2024

@live4soccer7 It show the integration not done yet even if it is done by my side.

Below are some screenshots of admin configuration, Braintree & Paypal:
screenshot-m247 com-2024 06 05-21_41_54

Paypal:
screenshot-developer paypal com-2024 06 05-22_12_43

Braintree:
screenshot-sandbox braintreegateway com-2024 06 05-21_54_34

Storefront:
Screenshot from 2024-06-05 22-09-52

Screenshot from 2024-06-05 21-58-55

Both braintree & Paypal sandbox created with same email Id and sandbox business id have used for india country & braintree sandbox account created for country india.

@live4soccer7
Copy link

This appears to be a different issue than what this thread has been experiencing.

@nordcomputer
Copy link

nordcomputer commented Jun 5, 2024

@neha023 I recently got it working on the shop I am working on. The error was not in the code. I had to get in touch with braintree, because they hadnt connected the braintree account with the paypal account or smth. similar. Took us about 3 weeks through some support tickets at braintree and paypal. So the error was on their end and not on ours.

@tobiasolge
Copy link

same problem with 2.4.6-p6 and patch is not working.

@dbashyal
Copy link

We are having same issue in 2.4.6-p6.

See screenshots.

braintree_paypal_1

braintree_paypal_2

@engcom-Hotel engcom-Hotel moved this to Ready for Development in High Priority Backlog Aug 19, 2024
@link2light
Copy link

link2light commented Aug 19, 2024

Had the same problem in 2.4.6-p6 - Strangely our BrainTree Account Manager recommended we try Adobe Payment Services as an alternative. We did but it clashed with another module (yet to be identified) so we switched back to BrainTree and are using PayPal outside of BrainTree for the moment. This works perfectly.

The other recommendation from BrainTree is to raise a support ticket and get the patch. That didn't work for us either. Now we're weighing up how much time to spend BrainTree debugging vs Adobe Payments debugging (to track down the conflicting module(s))

@CollegeSewing
Copy link

@link2light Braintree Payments are still very much available in Magento 2.4.7 (including -p2) as per the Gene Commerce docs
https://support.gene.co.uk/support/solutions/articles/35000228529

@live4soccer7
Copy link

I'm on 2.4.6-p7 and paypal works just fine with the usual fix in this thread.

@kartikmaniyar
Copy link

@link2light Braintree is completely available on all the current and upcoming Magento versions. If you don't mind then can I ask you to delete your comment as It will mislead merchants & developers.

I don't know why they have told you this but I would like to know the name of that Braintree person who has asked you this. are you able to share name of that Braintree guy with me?

@kartikmaniyar
Copy link

@link2light Please raise a support ticket here (https://support.gene.co.uk/support/home) and share all the details of that Braintree person and conversion if you can, thanks!

@kartikmaniyar
Copy link

@link2light Thank you for sending the email.
Could you please remove your both the comments which is specifying things about PayPal through Braintree?

@engcom-Bravo
Copy link
Contributor

Hi,

As per this comment #37242 (comment) issue has been fixed already we are closing this issue.

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Admin UI Component: Braintree Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Priority: P0 This generally occurs in cases when the entire functionality is blocked. Progress: done Reported on 2.4.6 Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch
Projects
None yet
Development

No branches or pull requests