File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -96,14 +96,25 @@ class FlutterwaveController extends Controller
9696 */
9797 public function callback()
9898 {
99+
100+ $status = request()->status;
99101
102+ //if payment is successful
103+ if ($status == 'successful') {
104+
100105 $transactionID = Flutterwave::getTransactionIDFromCallback();
101106 $data = Flutterwave::verifyTransaction($transactionID);
102107
103108 dd($data);
109+ }
110+ elseif ($status == 'cancelled'){
111+ //Put desired action/code after transaction has been cancelled here
112+ }
113+ else{
114+ //Put desired action/code after transaction has failed here
115+ }
104116 // Get the transaction from your DB using the transaction reference (txref)
105117 // Check if you have previously given value for the transaction. If you have, redirect to your successpage else, continue
106- // Confirm that the $data['data']['status'] is 'successful'
107118 // Confirm that the currency on your db transaction is equal to the returned currency
108119 // Confirm that the db transaction amount is equal to the returned amount
109120 // Update the db transaction record (including parameters that didn't exist before the transaction is completed. for audit purpose)
You can’t perform that action at this time.
0 commit comments