目次一覧
状態:回答待
閲覧数:586
投稿日:2019-08-22
更新日:2019-08-22
Q64
Q64
Q64
“No signatures found matching the expected signature for payload”.$ expectedSignature is not included in $ signatures
2019/8/22
The code where the error occurs.
webhook.php
error message
No signatures found matching the expected signature for payload
▼stripe-php/lib/WebhookSignature.php
Results of debugging
$ expectedSignature is not included in $ signatures
webhook.php
\Stripe\Stripe::setApiKey('xxxx');
$endpoint_secret = 'whsec_xxxx';
$payload = @file_get_contents('php://input');
$sig_header = $_SERVER['HTTP_STRIPE_SIGNATURE'];
$event = null;
try {
$event = \Stripe\Webhook::constructEvent(
$payload, $sig_header, $endpoint_secret
);
} catch(\UnexpectedValueException $e) {
http_response_code(400);
exit();
} catch(\Stripe\Error\SignatureVerification $e) {
//An error is caught here
}
error message
No signatures found matching the expected signature for payload
▼stripe-php/lib/WebhookSignature.php
$signatureFound = false;
foreach ($signatures as $signature) {
if (Util\Util::secureCompare($expectedSignature, $signature)) {
$signatureFound = true;
break;
}
}
if (!$signatureFound) {
throw new Error\SignatureVerification(
"No signatures found matching the expected signature for payload",
$header,
$payload
);
Results of debugging
$ expectedSignature is not included in $ signatures
'-----signatures-----'
array (
0 => '171abxxxx',
)
'-----expectedSignature-----'
'd1a55xxxx'
・"No signatures found matching the expected signature for payload".$ expectedSignature is not included in $ signatures