thephpleague / omnipay-sagepay

Sage Pay driver for the Omnipay PHP payment processing library
MIT License
55 stars 78 forks source link

"NotificationURL format is invalid" when using a local route #188

Closed markmead closed 2 years ago

markmead commented 2 years ago

Hello there 👋

I'm trying to update to v3 making use of SagePay_Server but when I use a named/local route for notifyUrl I hit the following error:

3011 : The NotificationURL format is invalid.

Here's the code that is causing the issue:

'notifyUrl' => route('payment.sagepay.notify'),

Results to something like http://localhost:12345/payment/notify.

Strangely (to me), if I pass in a route like http:://www.something123.test/ it works fine.

It's worth noting that I am using Lando.

judgej commented 2 years ago

Sage Pay will send a POST to the notify url. Make sure you don't have any CSRF security on that route. Laravel will use that by default, unless you explicitly disable it. Other frameworks are likely to do the same.

judgej commented 2 years ago

Though having read again, that's not the problem you are having!

The 3011 comes from the remote server. Could it be only accepting https?

judgej commented 2 years ago

Error documentation here https://www.opayo.co.uk/search/all?keyword=3011

markmead commented 2 years ago

I think HTTP is fine, but this line is the answer.

The NotificationURL field must contain a Fully Qualified Domain Name

Thankfully, Lando provides a http://name.land.site/ URL, I'll give that a whirl.

judgej commented 2 years ago

Oh course, that makes sense. You can use a service such as https://ngrok.com/ to tunnel the notifications to your local machine, if you aren't working on a public domain.

markmead commented 2 years ago

NGROK was the ticket, thanks a lot!

Now it's working I'm a little lost on how you handle where to redirect a user when they click "Cancel", I've looked through the README but I can't seem to find anything that answers this.

markmead commented 2 years ago

Ignore me, it was an issue in the code, hah! Thanks for all the help!

judgej commented 2 years ago

No, it was a good question that others are bound to hit, and you stuck around to confirm what the fix was :-)