I am a backend developer having redirection issue with Android google chrome.
The website i developed is integrated with a payment gateway.
The process for payment is as follow:-
1- Payment order created on website DB.
2- API request sent to payment gateway for creating a payment request.
3- API gateway response with providing a payment URL.
4- User been redirected to that payment URL.
5- Once user successfully paid and payment status get captured, the payment gateway website redirect user back to my website through the following link:-
6- In backend code Controller that process the route (/payment/callback) i have the following php code:-
public function callback(Request $request)
{
// Check if cancelled value = 1 (user cancelled) OR cancelled in knet payment page
if ($request->cancelled OR (!$request->cancelled && $request->Result == 'CANCELED') OR $request->Result != 'CAPTURED')
{
//Here to return to view if the payment is cancelled in gateway payment page
echo 'the request cancelled';
return redirect()->route('payment_status')->with($request->all());
}
//Query order
$order = Order::where('payment_ref',$request->hash)->first();
\Auth::login($order->user);
if ($order == null) {
return 'Could Not Find Order, Please Contact IT Support';
}
if (!$request->cancelled && $request->Result = 'CAPTURED')
{
if ($order->status === 'closed'){
die('This Page Has Been Expired');
}
$order->status = 'closed';
$order->save();
return redirect()->route('payment_status')->with($request->all());
}
The issue is when user using a google chrome (Android version) is show him a message :-
This Page Has Been Expired
While it suppose to show him the transaction details, as been made from the following code (other browsing is working fine):-
return redirect()->route('payment_status')->with($request->all());
I tried with the following google chrome mobile phone (Samsung Note 9 and OnePlus 3T).
*The php framework used (Laravel).
Please advice.
I believe the first problem is:
you assign here CAPTURED to result and it should be probably