Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return Url to my website clears the Cart::content() #650

Open
abdulrehman3725 opened this issue Jan 30, 2021 · 3 comments
Open

Return Url to my website clears the Cart::content() #650

abdulrehman3725 opened this issue Jan 30, 2021 · 3 comments

Comments

@abdulrehman3725
Copy link

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.

@abdulrehman3725
Copy link
Author

@Crinsane
Please help

I think the problem is with session. Session destroy after return URL form payment gateway.

@abdulrehman3725
Copy link
Author

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!

@Humourrack
Copy link

Humourrack commented Sep 2, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
@abdulrehman3725 @Humourrack and others