|
...
|
...
|
@@ -147,7 +147,6 @@ class PayStripeApi |
|
|
|
public static function handleWebhook()
|
|
|
|
{
|
|
|
|
try {
|
|
|
|
@file_put_contents(storage_path('logs/lyh_error.log'), var_export(11111, true) . PHP_EOL, FILE_APPEND);
|
|
|
|
// Webhook 签名密钥(从 Stripe 仪表盘获取)
|
|
|
|
$endpointSecret = 'whsec_garhW2TrCIrduyM3rve9mFS2sn69B9Yt';
|
|
|
|
// 获取原始请求内容
|
|
...
|
...
|
@@ -173,14 +172,12 @@ class PayStripeApi |
|
|
|
// 根据事件类型处理
|
|
|
|
switch ($eventType) {
|
|
|
|
case 'payment_intent.succeeded':
|
|
|
|
@file_put_contents(storage_path('logs/lyh_3059_error.log'), var_export('success', true) . PHP_EOL, FILE_APPEND);
|
|
|
|
// 处理支付成功逻辑
|
|
|
|
$paymentIntentId = $eventData['id'];
|
|
|
|
self::getExtensionInfo($paymentIntentId,$eventData);
|
|
|
|
break;
|
|
|
|
case 'payment_intent.payment_failed':
|
|
|
|
// 处理支付失败逻辑
|
|
|
|
@file_put_contents(storage_path('logs/lyh_error.log'), var_export($eventData, true) . PHP_EOL, FILE_APPEND);
|
|
|
|
$error = $eventData['last_payment_error'];
|
|
|
|
break;
|
|
|
|
case 'charge.refunded':
|
|
...
|
...
|
@@ -190,7 +187,7 @@ class PayStripeApi |
|
|
|
default:
|
|
|
|
throw new \Exception('Unhandled event type: ' . $eventType);
|
|
|
|
}
|
|
|
|
return $event;
|
|
|
|
return 1;
|
|
|
|
} catch (Exception $e) {
|
|
|
|
throw new \Exception('Webhook Error: ' . $e->getMessage());
|
|
|
|
}
|
...
|
...
|
|