The Flutterwave Developer Documentation

We have put together comprehensive guidelines and documentation to help you get right into integrating any of our products quickly. You can also get support when you need help!

API Documentation    API Reference
Ask A Question



Laravel Rave - Not receiving a webhook notification

I'm following the tutorial [here]( on how to set up webhooks and I'm doing everything as told. Firstly I'm running a transfer as follows: ``` public function initiateTransfer() { $reference = Flutterwave::generateReference(); $data = [ "account_bank"=> "GH280100", "account_number"=> "0031625807099", "amount"=> 1, "narration"=> "Test GHS bank transfers", "currency"=> "GHS", "reference"=> "new-GHS-test-transfer1", "callback_url"=> '', "destination_branch_code"=> "GH280103", "beneficiary_name"=> "Kwame Adew", 'reference' => $reference ]; $transfer = Flutterwave::transfers()->initiate($data); } ``` If, I do it like this the transfer goes through and if I go to my webhook url I can see the results like this: ``` { "event": "transfer.completed", "event.type": "Transfer", "data": { "id": 7794215, "account_number": "0031625807099", "bank_name": "ACCESS BANK GH LTD", "bank_code": "GH280100", "fullname": "Kwame adew", "created_at": "2021-03-28T13:38:07.000Z", "currency": "GHS", "debit_currency": null, "amount": 1, "fee": 5, "status": "FAILED", "reference": "flw_1616938685606086bda66e4", "meta": null, "narration": "Test GHS bank transfers", "approver": null, "complete_message": "DISBURSE FAILED: Insufficient funds in customer wallet", "requires_approval": 0, "is_approved": 1 } } ``` but if I change the callback url from ``` "callback_url"=> '', ``` to ``` "callback_url"=> '', ``` which is a reference to `routes\web.php` ``` Route::post('/webhook/flutterwave', 'Payments\[email protected]')->name('webhook'); ``` and is defined in the controller ``` public function webhook(Request $request) { $verified = Flutterwave::verifyWebhook(); if ($verified && $request->event == 'charge.completed' && $request->data->status == 'successful') { $verificationData = Flutterwave::verifyPayment($request->data['id']); if ($verificationData['status'] === 'success') { } } if ($verified && $request->event == 'transfer.completed') { $transfer = Flutterwave::transfers()->fetch($request->data['id']); if ($transfer['data']['status'] === 'SUCCESSFUL') { // update transfer status to successful in your db } elseif ($transfer['data']['status'] === 'FAILED') { // update transfer status to failed in your db // revert customer balance back } elseif ($transfer['data']['status'] === 'PENDING') { // update transfer status to pending in your db } } ``` I get no response. I have input my webhook url in the dashboard and also defined the secret hash in the dashboard and my `.env` file. What should I do to receive what is sent back to the webhook?

Posted by Timothy Githinji 15 days ago