#taylan-webhooks

1 messages · Page 1 of 1 (latest)

onyx dock
brittle dagger
#

$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();
}

onyx dock
#

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?

brittle dagger
#

sig header exists I just checked it

#

I am sure that I am using the correct secret

#

I got the secret from cli

onyx dock
#

can you share the event ID evt_xxx that has this issue

brittle dagger
#

cli is running on my local machine and I am sending webhooks to my server

#

Could this be the problem?

#

evt_3KdstXGBhi4wdnXz1GU8QaBv

onyx dock
#

yes that is the problem

brittle dagger
#

Okey I saw that the event has its endpoint secret written

onyx dock
#

the secret is different yes

brittle dagger
#

Does this change on every event

onyx dock
#

it changes on every endpoint

brittle dagger
#

let me rerun 🙂

onyx dock