Validates Stripe webhook signatures in Laravel applications.
// Source: https://github.com/spatie/laravel-stripe-webhooks | License: MIT | Copyright Spatie bvba <info@spatie.be>
// Provided via justclaw.it.com; keep this notice with the code.
<?php
namespace Spatie\StripeWebhooks;
use Exception;
use Illuminate\Http\Request;
use Spatie\WebhookClient\SignatureValidator\SignatureValidator;
use Spatie\WebhookClient\WebhookConfig;
use Stripe\Webhook;
class StripeSignatureValidator implements SignatureValidator
{
public function isValid(Request $request, WebhookConfig $config): bool
{
if (! config('stripe-webhooks.verify_signature')) {
return true;
}
$signature = $request->header('Stripe-Signature');
$secret = $config->signingSecret;
try {
Webhook::constructEvent($request->getCon
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key