作者 lyh

gx数据

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