WordPress Verify Woocommerce webhooks in PHP Laravel 6

Today, We want to share with you WordPress Verify Woocommerce webhooks in PHP Laravel 6.In this post we will show you wordpress plugin require another plugin, hear for Receive WooCommerce webhoops in Laravel apps we will give you demo and example for implement.In this post, we will learn about How to Connect Your PHP Based Web App to the WooCommerce Rest API with an example.

WordPress Verify Woocommerce webhooks in PHP Laravel 6

There are the Following The simple About WooCommerce Webhooks verification in PHP Full Information With Example and source code.

READ :  PHP Application URL Routing Removing file extensions

As I will cover this Post with live Working example to develop WooCommerce Webhooks verification in Laravel application, so the Send data from Woocommerce to Laravel via webhook is used for this example is following below.

Example 1: laravel verify Woocommerce WordPress webhook
public function handle($request, Closure $next)
$signature = Request::header(‘x-wc-webhook-signature’);
//$payload = @file_get_contents(‘php://input’);

$payload = file_get_contents(‘php://input’);

//$payload = json_decode( $payload, true);
$calculated_hmac = base64_encode(hash_hmac(‘sha256’, $payload, $secret_key, true));

if($signature != $calculated_hmac) {
return false;

return $next($request);

Example 2: Get data from Woocommerce to Laravel via webhook verify

$all_header =$request->headers->all();

$hmac_header = $request->header(‘x-wc-webhook-signature’);

$payload = file_get_contents(“php://input”);

$website_domain = $request->header(‘x-wc-webhook-source’);

$webs = Webs::where([‘website_domain’=>$website_domain])->first();

$secret_key = $webs->secret_key;

READ :  C# Anonymous Types Tutorial with Examples

$calculated_hmac = base64_encode(hash_hmac(‘sha256’, $payload, $secret_key, true));

dump($hmac_header . “: ======= :” . $calculated_hmac);
if($hmac_header == $calculated_hmac){
dump(“laravel verify Woocommerce WordPress webhook”);
} else {
dump(“error For : laravel verify Woocommerce WordPress webhook”);



Web Programming Tutorials Example with Demo

Read :


You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about Validating Woocommerce webhook using HMAC in PHP.
I would like to have feedback on my infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Leave a Comment