eileenmcnaughton / nz.co.fuzion.omnipaymultiprocessor

Omnipay Multi Processor Payment Processor For CiviCRM
Other
13 stars 44 forks source link

Problem with Paypal checkout configuration #194

Open russ-manta opened 3 years ago

russ-manta commented 3 years ago

I've followed the instructions here https://github.com/eileenmcnaughton/nz.co.fuzion.omnipaymultiprocessor/blob/master/docs/Paypal.md, setting up the api and the processor in CiviCRM and added to a simple contribution page but whenever I try clicking the paypal button the popup starts loading but then fails with 'Site is not correctly configured to process payments'. Using php 7.2, CiviCRM 5.32.1 and Omnipay extension 3.13.

Is there anything I'm missing other than enabling the extension and settings up the processor, contribution page and api within PayPal or any other way to debug, I have no other error messages apart from the 'Site is not correctly configured to process payments' message.

Thanks

mlutfy commented 3 years ago

hi @russ-manta I have stumbled on the same issue. Were you able to resolve it?

eileenmcnaughton commented 3 years ago

@mlutfy I've hit it - I just cant' remember the solution - I think it's to do with credentials. I think I mostly hit it by trying to use test credentials in non-test mode

mlutfy commented 3 years ago

Oddly the problem seems to have gone away on its own. My colleague thinks perhaps it was a cache issue on our end. (they had also opened a support request with PayPal, but I doubt they had time to process it)

eileenmcnaughton commented 3 years ago

interesting

mattwire commented 3 years ago

The Site is not correctly configured to process payments comes from this extension. It will happen in multiple circumstances because the existing js code in this extension only works with a fairly specific contribution page configuration - specifically when calculateTotalFee() is defined as a js function on the form: https://github.com/eileenmcnaughton/nz.co.fuzion.omnipaymultiprocessor/blob/master/Metadata/js/omnipay_PaypalRest.js#L33

To work in all situations you need a much more complex function to get the amount, a well-commented example of which can be found here: https://lab.civicrm.org/extensions/mjwshared/-/blob/master/js/crm.payment.js#L11

This PR takes the paypal checkout integration compatibility to be the same as Stripe, introducing a dependency on mjwshared library which implements a full js payment library to interact with CiviCRM: https://github.com/eileenmcnaughton/nz.co.fuzion.omnipaymultiprocessor/pull/166

mwestergaard commented 3 years ago

@mattwire Your comment relates to my issue https://github.com/fuzionnz/nz.co.fuzion.extrafee/issues/16. It seems I can change https://github.com/eileenmcnaughton/nz.co.fuzion.omnipaymultiprocessor/blob/master/Metadata/js/omnipay_PaypalRest.js#L33 to get around my issue (for my currency):

<           var paymentAmount = calculateTotalFee().toFixed(2);
---
>           var paymentAmount = calculateTotalFee();
kurund commented 2 years ago

@mattwire @eileenmcnaughton

I am facing same error on CiviCRM v48.2 and Omnipay 3.16.

In the console I get following error:

create_order_error {err: 'Payment failed. Check your site credentials'

Credential are correct.

Any thoughts on how to resolve this?

eileenmcnaughton commented 2 years ago

@kurund does the paypal account have Reference Transactions enabled? https://github.com/eileenmcnaughton/nz.co.fuzion.omnipaymultiprocessor/blob/master/docs/Paypal.md

kurund commented 2 years ago

@eileenmcnaughton

It is working fine on prod instance, which is on CiviCRM 5.36.1 and Omnipay 3.14. Is this new requirement?

eileenmcnaughton commented 2 years ago

@kurund reference transaction support is needed for recurring

kurund commented 2 years ago

@eileenmcnaughton

Recurring is working fine on current prod. So I am assuming reference transaction support is enabled. However, I will double check. Thank you.

kurund commented 2 years ago

CiviCRM 5.36.1 and Omnipay 3.14. On clicking PayPal button, following URL's are invoked

CiviCRM v48.2 and Omnipay 3.17.

Any thoughts?

kurund commented 2 years ago

Debugging further it looks like

https://github.com/eileenmcnaughton/nz.co.fuzion.omnipaymultiprocessor/blob/b80d86716ec25a57c204e72c9d87ddc083c0d13a/Metadata/js/omnipay_PaypalRest.js#L38

API request is sent to the wrong URL.

Correct URL: <site-name>/?civiwp=CiviCRM&q=civicrm/ajax/rest but it is sent to <site-name>/civi/placeholder-url-path/

Is there some changes in latest Civi? I am wondering if this is specific to WordPress.

Thoughts?

mattwire commented 2 years ago

@kurund does this help? https://github.com/civicrm/civicrm-core/pull/23420

kurund commented 2 years ago

@mattwire

Thank you. Yes it worked like a charm :)