PHP code example of adejorosam / laravel-flutterwave-webhook

1. Go to this page and download the library: Download adejorosam/laravel-flutterwave-webhook library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

adejorosam / laravel-flutterwave-webhook example snippets


return [

    /*
     * Flutterwave will sign each webhook using the secret hash you fielded. 
     * You can do that at the webhook configuration settings: https://dashboard.flutterwave.com/account/webhooks.
     */
    'signing_secret' => env('SECRET_HASH'),


    /*
     * The classname of the model to be used. The class should equal or extend
     * \Spatie\WebhookClient\ProcessWebhookJob.
    */
    'process_webhook_job' => '',
];


Route::flutterwaveWebhooks('webhook-route-configured-at-the-flutterwave-dashboard');

protected $except = [
    'webhook-route-configured-at-the-flutterwave-dashboard',
];


namespace Adejorosam\LaravelFlutterwaveWebhook;

use \Spatie\WebhookClient\ProcessWebhookJob;

//The class extends "ProcessWebhookJob" class as that is the class
//that will handle the job of processing our webhook before we have
//access to it.


class ProcessFlutterwaveWebhook extends ProcessWebhookJob
{
    public function handle()
    {
        $data = json_decode($this->webhookCall, true);
        //Do something with great with this!
       http_response_code(200); //Acknowledge you received the response
    }
}
bash
php artisan vendor:publish --provider="Adejorosam\LaravelFlutterwaveWebhook\LaravelFlutterwaveWebhookServiceProvider" --tag="config"
bash
php artisan vendor:publish --provider="Adejorosam\LaravelFlutterwaveWebhook\LaravelFlutterwaveServiceProvider" --tag="migrations"
bash
php artisan migrate