Skip to content

Magento 2.2 Paypal Can't Accept Checkout Agreements Before Routing to PayPal #11885

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

Closed
Silarn opened this issue Oct 30, 2017 · 51 comments
Closed
Labels
Fixed in 2.2.x The issue has been fixed in 2.2 release line Fixed in 2.3.x The issue has been fixed in 2.3 release line Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release

Comments

@Silarn
Copy link

Silarn commented Oct 30, 2017

This could potentially be a module conflict, but after stepping through and inspecting the checkout code I can't find any obvious third-party interference.

When going through standard checkout and selecting PayPal Express at the payment step, there is an agreements checkbox present. However, checking this box does nothing as the agreements data is not parsed and passed to the set-payment-information API. This triggers the CheckoutAgreements validation plugin which fails to validate with no agreements data.

When I override the PayPal JS to add the agreements data to the paymentData before sending to the API, it passes validation but then fails because PayPal doesn't allow setting extension data.

The only way I was able to work around the problem was by overriding the validation classes and skipping validation when the method was PayPal Express.

I was not experiencing this issue on prior versions of Magento 2, nor does it make sense to have agreements here since you must accept them again during the review step.

Preconditions

  1. Magento 2.2 (maybe earlier?)
  2. PHP 7.0 or 7.1
  3. PayPal Express enabled in-checkout payment methods
  4. Checkout Agreements created and required

Steps to reproduce

  1. Attempt to check out with PayPal Express with the agreements box checked
    (It does not seem to matter whether or not in-context is enabled - though for in-context the flow is even worse as it opens the pop-up window and then fails the payment submission leaving the window open in a failed state.)

Expected result

  1. Proceed to PayPal Express checkout as normal

Actual result

  1. A validation error is returned whether or not the agreement box is checked (though the JS validation will fail without it anyway).
@magento-engcom-team magento-engcom-team added Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed labels Oct 30, 2017
@magento-engcom-team
Copy link
Contributor

@Silarn, thank you for your report.
We've created internal ticket(s) MAGETWO-83068 to track progress on the issue.

@magento-engcom-team magento-engcom-team added 2.2.x Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release labels Oct 31, 2017
@josephmcdermott
Copy link
Contributor

Confirm this issue on vanilla Magento CE 2.2. The agreement IDs are not populated in the request to /V1/carts/mine/set-payment-information whereas they are for other methods like checkmo.

Pretty urgent one this i'd say...

@Silarn
Copy link
Author

Silarn commented Nov 3, 2017

As I mentioned in the op, even if you add the agreement data to the API call, it still fails because the PayPal payment type complains that it can't save custom data. Best workaround is to override the validator and skip it for PayPal Express for the time being.

@lexwet
Copy link

lexwet commented Nov 7, 2017

Same issue.
Magento 2.2.0
PHP: 7.0.24

Users can not proceed to Paypal.
"Please agree to all the terms and conditions before placing the order."

Is there any quick/hotfix for this issue?

@nelero
Copy link

nelero commented Nov 8, 2017

same problem for other payment methods except checkmo. (Monetico CM CIC payment in our case).
This was functional in 2.1.9 but not now on CE 2.2.1 version.

@johwebserv
Copy link

johwebserv commented Nov 14, 2017

same problem for all other payment methods since 2.2.0. The agreement is checked, but magento checkout shows a pop-up message with "please agree to all the terms and conditions before placing the order."
In our case it's no solution to disable agreements in checkout to use all payment methods (paypal etc.).

image

@BNEP
Copy link

BNEP commented Nov 15, 2017

same here, we are running Magento version CE 2.2.1
We have only one agreement configured (btw.: The configuration of agreements is buggy, too. One can not modify existing entries)
the xhr page set-payment-information returns this error, but the box IS checked. Then paypal popup hangs...
{ "message": "Bitte akzeptieren Sie die Geschäftsbedingungen, bevor Sie eine Bestellung aufgeben." }
Request is:
{"cartId":"32","paymentMethod":{"method":"paypal_express","po_number":null,"additional_data":null}}
Hope to get a solution soon...

@charleskj
Copy link

We are also getting the same issue in latest version 2.2.1.
This is a critical error in magento which blocks paypal payment completely, appreciate if any body have patch for this

@ghost
Copy link

ghost commented Nov 16, 2017

In the agreement settings, i set the mode of the agreement to automatically. Then there is no checkbox at the checkout (just the text) and the payment works. Maybe this is a temporary solution until magento fixed this issue.

@josephmcdermott
Copy link
Contributor

@CYBKBL ah yes, good suggestion. I've applied the same for the time being and it works well. Just have to change the wording a little to 'By checking out I agree to...' Thanks.

@avoelkl
Copy link
Contributor

avoelkl commented Nov 17, 2017

Having the same issue with Bank Transfer Payment and other payment methods with Magento 2.2.1 as well.

@roman204
Copy link

roman204 commented Dec 1, 2017

This is really not nice, struggled around with it and in the end i wrote a module which provides a quick fix to get the payment via paypal back for shops which are online now and cant wait for a new version.

@fwolfst
Copy link

fwolfst commented Dec 9, 2017

@roman204 confirm that the fix resolves the issue for us. Pretty shocked by the amount of issue 2.2.1 (and earlier versions) gives us.

@nelero
Copy link

nelero commented Dec 9, 2017 via email

@avoelkl
Copy link
Contributor

avoelkl commented Dec 12, 2017

@roman204 do you want to provide a Pull Request to fix the issue in the core as well?! :)

@roman204
Copy link

hy @avoelkl, there is currently a pull request from someone, my solution is only for those who can't wait until a new version of magento is released.

@avoelkl
Copy link
Contributor

avoelkl commented Dec 12, 2017

Sorry, seems I missed that 😅 @roman204

@mvedana
Copy link

mvedana commented Feb 10, 2018

in ExpressPlugin there is a typo:

... Plugin\Magento\Paypa\Model ...

has to be changed to

... Plugin\Magento\Paypal\Model ....

@23digitalTest
Copy link

Hi Ričards (@therool),
Thanks for your code guide and interestingly it is working for me. really Appreciated !

@23digitalTest
Copy link

Hi,

Very thankful - Luckily this fix is being working for us.

Tried to understand that fix to know what causes the issue actually. But not cleared whats wrong within 'additional data' of 'extension attribute key' ! (http://devdocs.magento.com/guides/v2.0/extension-dev-guide/attributes.html)

Due to this fix, I would like to confirm that can there be any possibilities of having security hole in Magento-to-PayPal-to-Magento transaction ?

And also, can there be any possibility of data loss ? if yes then please advise if any.

Thanks & Regards.

@therool
Copy link
Contributor

therool commented Feb 16, 2018

@23digitalTest there is no dataloss and no security issues with that fix, it just skips the extension_attributes object which just contains checkout agreement ids information, the need to unset the "extension_attributes" key is that it is an object and it can't be assigned to info instance and it contains no paypal data. https://github.com/magento/magento2/blob/2.2.2/app/code/Magento/CheckoutAgreements/view/frontend/web/js/model/agreements-assigner.js#L36, https://github.com/magento/magento2/blob/2.2-develop/app/code/Magento/Paypal/Model/Express.php#L628, https://github.com/magento/magento2/blob/2.2-develop/app/code/Magento/Payment/Model/Info.php#L154.

@23digitalTest
Copy link

Hi,

Cool..very informative. Thanks a lot!

Regards,

@robysalv
Copy link

robysalv commented Mar 3, 2018

Hi
I installed the latest version Magento 2.2.3 but there is the same issue.
Conflict wit paypal and accept terms and condition.

What can I do?

Regards
Roberto

@roman204
Copy link

roman204 commented Mar 3, 2018

@robysalv cou can try my fix here: https://github.com/CopeX/PaypalFix I think it should work also in 2.2.3.

This is getting ridiculous, sorry Magento-Team i love your work and so on but i think you should prioritize such bugs a bit more.

@robysalv
Copy link

robysalv commented Mar 3, 2018

thank you roman204

@ghost
Copy link

ghost commented Mar 7, 2018

@roman204 Will the module work for Thrid-Party Payment Extensions too? (Paypal via Cardprocess payment module.)

@roman204
Copy link

roman204 commented Mar 7, 2018

@yacms i dont think so because its only a fix for paypal module which is a magento core module

@topranavp
Copy link

Does anyone have fix of this, as I am also facing the same issue with Payumoney method installed in my system.

@gesell
Copy link

gesell commented Apr 28, 2018

Facing same issue after upgrading from Magento 2.1.3 to 2.2.3.

Above solutions do not work for me unfortunately. Even roman204*s extension is not working for me.

@roman204 Have you tested against 2.2.3 by chance? Thank you so much for your efforts on this fix.

@roman204
Copy link

Yes i did test it with 2.2.3. Cause i developed it on that version.

@zakgrindle
Copy link

I can confirm that this issue is still present in 2.2.3 for me too. Thanks @roman204 for your module, it has been a lifesaver!

@magento-engcom-team - why is this still present several releases after it was marked as fixed? With the upcoming introduction of GDPR in Europe having Terms and Conditions working at checkout is going to be essential.

@david-fiaty-cko
Copy link

+1

@Valentin-Huwer
Copy link

@roman204 Thanks for your module, when I install it it doesn't really solve the problem though. It just makes PayPal disappear completely. Kinda solves the problem, but yeah - You have any advice? And this seems to be rather old, how come that Magento did not release a fix for that yet..

@bobemoe
Copy link
Contributor

bobemoe commented Jun 8, 2018

Still exists in 2.2.4 :( Can we give this higher priority? Client needs this functionality ASAP as GDPR legislation requires it in Europe! Cheers

@roman204
Copy link

roman204 commented Jun 9, 2018

@Valentin-Huwer hmm seems to be another problem, we got now 2 shops online with our fix for paypal with magento2 and both work very well.

@gesell
Copy link

gesell commented Jun 9, 2018

Have you tried Magento 2.2.5? There the issue is gone for me. No other mentioned fix did work for me either.

@mikidip
Copy link

mikidip commented Jun 13, 2018

@roman204 I try to install your fix but i don't know how to bypass the error message via composer:
[InvalidArgumentException]
Could not find package PaypalFix at any version for your minimum-stability (stable). Check the package spelling or your minimum-stability
Can you help me?

@roman204
Copy link

roman204 commented Jun 13, 2018

You have to configure also the url of the git repo in composer.json file

@mikidip
Copy link

mikidip commented Jun 13, 2018

@roman204 Sorry, can you make me an example?

@roman204
Copy link

Like that:
"repositories": [
{
"type": "vcs",
"url": "https://github.com/igorw/monolog"
}
],

@david-fiaty-cko
Copy link

david-fiaty-cko commented Jun 14, 2018

The T&C checkbox used to work and started showing this issue in the 2.2.x series. We have some clients who think this error is not a core issue but third party module issue.

Could someone please clearly establish if the "please agree to all the terms and conditions before placing the order." issue is a core issue or not, and how we can fix in third party modules?

@MiomenteMUC
Copy link

Am I wrong or does it say, it is fixed in 2.2.X?
Got 2.2.3 and the same problem.

Anyone sure if it is fixed in 2.3? Gonna do a update then...

@domeglic
Copy link

Fixed in 2.2.x is kind of misleading. I guess it means it was fixed in the latest 2.2.x version at the time the tag was added. Sometimes you also have a comment saying "will be fixed in upcoming version 2.2.7 but then it isn't.

To be really sure you should go to the release page and ctrl+f this issue number. If it was included then it will be part of the Community contributions list. This one was added in 2.2.4.

@fohnbit
Copy link

fohnbit commented Apr 16, 2019

n ExpressPlugin there is a typo:

... Plugin\Magento\Paypa\Model ...

has to be changed to

Hello,

please, where did I find this file?

Thank you!

@mbautista
Copy link

@roman204 quick fix worked for us, thank you very much :)
Here is the code to install this fix :

composer config repositories.copex/module-paypalfix git [email protected]:CopeX/PaypalFix.git
composer require copex/module-paypalfix:dev-master -n
bin/magento module:enable CopeX_PaypalFix
bin/magento setup:upgrade

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fixed in 2.2.x The issue has been fixed in 2.2 release line Fixed in 2.3.x The issue has been fixed in 2.3 release line Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release
Projects
None yet
Development

No branches or pull requests