Welcome Guest, Not a member yet? Register   Sign In
Payment gateway response URL not working
#1
Question 

Hi,
I am trying to integrate the CCAvenue payment gateway into my project everything works but when I cancel the payment or the payment is successful, the payment gateway sends data to the response link for that I have created a function and route for that.
the function works when I call using the browser but when payment gateways try to redirect to that link, the payment gateway does not find the link and I get a 404 error by payment gateway, The page you're looking for cannot be found!

 I tried contacting the payment gateway and they say that the response page is not accessible by the payment gateway.

the routes I tried
Code:
$routes->post('response', 'Payment::paymentResponse');
or
$routes->match(['get', 'post'], 'response', [Payment::class, 'paymentResponse']);
Reply
#2

If available in the browser. So everything works.
Maybe you are using a broken link for the gateway.
Or, for example, some of your global filters are blocking.
Reply
#3

(05-15-2023, 03:07 AM)iRedds Wrote: If available in the browser. So everything works.
Maybe you are using a broken link for the gateway.
Or, for example, some of your global filters are blocking.

yes, it's available in the browser.
what can be the issue?
Reply
#4

ok, it was the csrf filter causing a redirect so the CCAvenue gateway was unable to find the response page.
I disabled it and now everything works as expected.
but now the security is weak of course, so the question now is,
is there a way to just bypass csrf for the payment gateway response?

if not is there a way to send csrf value and key to the payment gateway and then receive the same and it will validate the post request?
I tried changing the csrf token name to one extra parameter which the payment gateway accepts and then I got the key and the value in the response but even then it didn't work, page was redirected and again response page was not found by the gateway response.

any help, how can we achieve this? without removing csrf filter?
Reply
#5

CSRF uses cookies. The gateway will not send you cookies.
Disable the CSRF filter for this address.

Typically, payment gateways have mechanisms for verifying the data sent. This is basically enough.
Reply
#6

Thank you everyone for the reply.

the solution is to disable CSRF just for that particular route/link
for ex.


PHP Code:
public array $globals = [
        'before' => [
            'csrf' => ['except' => ['response']], 
Reply




Theme © iAndrew 2016 - Forum software by © MyBB