Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Webhook Signatures? #113

Closed
thorlucas opened this issue Nov 13, 2018 · 2 comments
Closed

Webhook Signatures? #113

thorlucas opened this issue Nov 13, 2018 · 2 comments

Comments

@thorlucas
Copy link

There's currently no way to verify webhook signatures using this package, is there? This makes webhooks practically unusable considering how unsafe it is.

@lukecurtis93
Copy link

You could make your own implementation in the mean time, this is a laravel example -laravel/cashier-stripe#437 (comment)

If you're not using laravel this is the important bits

try {
            WebhookSignature::verifyHeader(
                $request->getContent(),
                $request->header('Stripe-Signature'),
                $this->config->get('services.stripe.webhook.secret'),
                $this->config->get('services.stripe.webhook.tolerance')
            );
        } catch (SignatureVerification $exception) {
            $this->app->abort(403);
        }

You just need to use the appropriate helpers/functions from your specific framework to get these parameters

@brunogaspar
Copy link
Member

Not entirely sure this really belongs on the library level, since the library itself is mostly to interact with the Stripe API.

On my end, with Laravel, i've created a middleware to achieve this, and on the Webhook controller i use that middleware. If needed i can share the middleware.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants