#taylan-webhooks
1 messages · Page 1 of 1 (latest)
$payload = @file_get_contents('php://input');
$sig_header = $_SERVER['HTTP_STRIPE_SIGNATURE'];
$event = null;
try {
$logger->saveFile($payload, 'init.txt');
$event = \Stripe\Webhook::constructEvent(
$payload, $sig_header, $endpoint_secret
);
} catch (\UnexpectedValueException $e) {
// Invalid payload
$logger->saveFile($e->getMessage(), 'init.txt');
http_response_code(400);
exit();
} catch (\Stripe\Exception\SignatureVerificationException $e) {
// Invalid signature
$logger->saveFile($e->getMessage(), 'init.txt');
http_response_code(400);
exit();
}
can you log the value of $sig_header to be sure it exists?
and are you sure you are using the correct value for the $endpoint_secret?
sig header exists I just checked it
I am sure that I am using the correct secret
I got the secret from cli
can you share the event ID evt_xxx that has this issue
cli is running on my local machine and I am sending webhooks to my server
Could this be the problem?
evt_3KdstXGBhi4wdnXz1GU8QaBv
yes that is the problem
Okey I saw that the event has its endpoint secret written
the secret is different yes
Does this change on every event
it changes on every endpoint
let me rerun 🙂
when you create the endpoint(e.g https://dashboard.stripe.com/webhooks/we_1KdbcgGBhi4wdnXzJ7hjIpd5) it has its own secret and you configure the code you have running at that URL to use that one