Comments (8)
in fact you already have what you need.
in spatie/laravel-stripe-webhooks/src/StripeSignatureValidator.php
you have
class StripeSignatureValidator implements SignatureValidator
{
public function isValid(Request $request, WebhookConfig $config): bool
{
if (! config('stripe-webhooks.verify_signature')) {
return true;
}
...
}
}
seems to me all you need to do is set config(['stripe-webhooks.verify_signature' => false]);
before running your test.
from laravel-stripe-webhooks.
Can you give an concrete example of a situation where you want to skip the signing secret verification?
from laravel-stripe-webhooks.
In testing environment you may want to skip this verification?
Just apply the middleware in staging and production.
In a local env you also have to deal with valet share
and ngrok
with unsupported SSL. So sending test webhooks from Stripe may be a little pain. In my case I use Postman to reach my webhook endpoint, but the signature verification stops me.
An option to apply the middleware based on a boolean (default true
) would do the job.
Best
from laravel-stripe-webhooks.
You can set a non-https url in the Stripe dashboard.
from laravel-stripe-webhooks.
Have you figured it out how to pass signature verification in your tests?
from laravel-stripe-webhooks.
@adriandmitroca Finally I didn't use this package. I've added myself a signature verification in production only.
from laravel-stripe-webhooks.
That's good to know, thanks. Anyway, if someone else will struggle with this in the future, my idea is to execute jobs separately in the tests to verify expected results.
There's no real need to test it any level higher, as those stuff is covered by package tests.
from laravel-stripe-webhooks.
I found a dirty solution for this...
Instead of using Route::stripeWebhooks('stripe/webhook');
Use your own controller : Route::post('stripe/webhook', 'WebhookController');
Then override the __construct method to use the VerifySignature middleware when you want :
use Spatie\StripeWebhooks\Middlewares\VerifySignature;
use Spatie\StripeWebhooks\StripeWebhooksController;
class WebhookController extends StripeWebhooksController
{
public function __construct()
{
if (!in_array(app()->environment(), ['testing', 'local'])) {
$this->middleware(VerifySignature::class);
}
}
}
from laravel-stripe-webhooks.
Related Issues (20)
- Upgrade guide incomplete HOT 1
- Webhook Calls Table Hanging Database HOT 1
- v3 Upgrade guide: Include payload column type change
- Syntax error when processing webhook call HOT 1
- Cannot install package using composer HOT 1
- Spatie\WebhookClient\Exceptions\InvalidConfig: `Spatie\StripeWebhooks\StripeWebhookProfile` is not a valid webhook profile class. A valid web hook profile is a class that implements `Spatie\WebhookClient\WebhookProfile\WebhookProfile`
- Typo in StripeWebhooksController 2.6.2 HOT 2
- Testing for signs of life that webhook jobs are executed
- Routing for using Stripe CLI
- Invalid Signature
- Webhook not hitting the job HOT 1
- URGENT: Deployed to Forge server and now website broken, getting Attribute [stripeWebhooks] does not exist.
- No publishable resources for tag [webhook-client-migrations]
- Unable to generate log event using the Job
- README for v3 HOT 1
- Jobs do not run for Stripe event names that already have `_` in them. HOT 1
- Webhook Model can't be overridden (Root issue https://github.com/spatie/laravel-webhook-client/issues/201) HOT 1
- InvalidArgumentException with stripeWebhooks Attribute in Laravel 11 using spatie/laravel-webhook-client v3.7.0 HOT 1
- Custom connection and queue for webhook jobs HOT 3
- stripe/stripe-php:^15.0 compatibility HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from laravel-stripe-webhooks.