Closed j-greig closed 4 years ago
So weird, as soon as I'd posted this it somehow started working locally — still not working on staging though...
Perhaps the docs would benefit from a checklist to help people avoid this issue as it seems quite common.
Hi @j-greig
It would be great if you could provide fulls details on that would reproduce this error. This would include things like product names, taxes applied, shipping methods, billing and shipping addresses.
Unfortunately, I am unable to replicate the issue. This usually means that it comes down to something out of these three things:
1) PayPal account 2) Data on the order 3) Custom code
As noted in your screenshot you have a "service error" response from PayPal there is also a debug ID that you can use when contacting PayPal customer support for them to be able to look into the logs. To me, that error sounds like a 500 error on the PayPal sandbox (which unfortunately is not uncommon) this would explain why it started working again.
Thanks @nfourtythree, if I get some downtime I'll try and replicate on a vanilla install of Craft too. Will let you know either way though : )
Can confirm that the demo /shop templates work fine locally and the PayPal popup opens, and can complete the purchase.
I've also noticed that if I trigger the PayPal popup via our custom template shortly after testing (1.), the order ID error doesn't happen and the PayPal popup/pamment magically works. (Not sure what this means though, it's like the session carries over or something... ? 🤷♂️)
Hi @j-greig
Glad you have got this working. To me, as I mentioned before, it seems like this was an intermittent issue with PayPal sandbox. Which, from my previous experience, is not uncommon.
Will close the issue for now, but please post an update if you find a way of consistently replicating the issue.
Thanks!
What data order could affect this?
I have just copied the form button and JS function from the plugin code verbatim into my template and still getting the missing order ID error locally most of the time.
Driving me a bit nuts now!
One thing I've just noticed — sometimes the missing order ID error even happens when using your /shop demo templates. Not all of the time though...
Hi @j-greig
Any data in the order, items, addresses, adjusters etc. Without knowing what is causing it, it is difficult to say.
Also with the fact that it is intermittent, it would likely mean it is a PayPal thing (if you are using the same data).
As I mentioned before to be able to help we need a reliable way of reproducing the error. That would mean providing all the steps along the way. What products were used, how many were added to the cart, in what order, what addresses were using, were both addresses supplied, gateway settings, Paypal account settings etc.
As you can see there is a lot of information that could be at play here, so we really need a concrete way of producing the error to give us a chance to hunt it down and fix it.
Here are some comments by a PayPal dev on another issue that encourage people to get the debug ID and contact PayPal customer support: comment 1, comment 2 and comment 3 (explains how to get the debug id)
Thanks.
Thanks for clarifying @nfourtythree !
I can't follow those steps to get the debug ID as the PayPal checkout popup window doesn't stay open.
Will revert to the old Paypal gateway for now I think : (
@j-greig to get the debug ID you only need to look for the call to the Paypal /graphql
endpoint in your network tab of dev tools.
You can also see it in the first screenshot that you posted:
Am getting the "Expected an order id to be passed" error in my local dev environment (Valet)....
What might I have missed?
Update: log for my payment attempts locally, lots of gateway errors before it finally worked.