作者 lyh

gx数据

... ... @@ -142,17 +142,13 @@ class PayStripeApi
*/
public static function handleWebhook()
{
@file_put_contents(storage_path('logs/lyh_error.log'), var_export('start', true) . PHP_EOL, FILE_APPEND);
try {
// Webhook 签名密钥(从 Stripe 仪表盘获取)
$endpointSecret = 'whsec_garhW2TrCIrduyM3rve9mFS2sn69B9Yt';
@file_put_contents(storage_path('logs/lyh_error.log'), var_export($endpointSecret, true) . PHP_EOL, FILE_APPEND);
// 获取原始请求内容
$payload = request()->getContent();
@file_put_contents(storage_path('logs/lyh_error.log'), var_export($payload, true) . PHP_EOL, FILE_APPEND);
// 获取 Stripe 签名头
$sigHeader = request()->header('Stripe-Signature');
@file_put_contents(storage_path('logs/lyh_error.log'), var_export($sigHeader, true) . PHP_EOL, FILE_APPEND);
// 验证签名
if (!self::verifySignature($payload, $sigHeader, $endpointSecret)) {
return [
... ...