LaravelShoppingcart
LaravelShoppingcart copied to clipboard
Return Url to my website clears the Cart::content()
I am using payment api for payment. After successful payment a return URL hits to my website. But now cart::content() is empty
Why?
How to persist data?
I am using laravel 8.
@Crinsane Please help
I think the problem is with session. Session destroy after return URL form payment gateway.
My problem is solved.
I have changed the following in config/session.php file:
'same_site' => 'lax',
To the below value:
'same_site' => null,
Now session are persistent even after return URL from payment gateway!
Check your Callback function.
Because the cart can be cleared when it exists in your callback function.
I hope you understand what I mean by "callback"?
Take for instance, FLUTTERWAVE Payment 💲 Gateway.......
public function callback() {
$status = request()->status; //if payment is successful
if ($status == 'successful') {
$transactionID = Flutterwave::getTransactionIDFromCallback();
$data = Flutterwave::verifyTransaction($transactionID);
dd($data);
} elseif ($status == 'cancelled'){
//Put desired action/code after transaction has been cancelled here } else{ //Put desired action/code after transaction has failed here
}
// Get the transaction from your DB using the transaction reference (txref)
// Check if you have previously given value for the transaction. If you have, redirect to your successpage else, continue
// Confirm that the currency on your db transaction is equal to the returned currency
// Confirm that the db transaction amount is equal to the returned amount
// Update the db transaction record (including parameters that didn't exist before the transaction is completed. for audit purposes)
// Give value for the transaction
// Update the transaction to note that you have given value for the transaction
// You can also redirect to your success page from here
}
Check this link for a better understanding _https://laravelrave.netlify.app/getting-started/payment-implementation.html#3-setup-your-controller