|
...
|
...
|
@@ -152,7 +152,7 @@ class PayStripeApi |
|
|
|
// 验证签名
|
|
|
|
if (!self::verifySignature($payload, $sigHeader, $endpointSecret)) {
|
|
|
|
http_response_code(400);
|
|
|
|
throw new Exception('Invalid signature');
|
|
|
|
throw new \Exception('Invalid signature');
|
|
|
|
}
|
|
|
|
$event = json_decode($payload, true);
|
|
|
|
// 获取事件类型
|
|
...
|
...
|
@@ -175,11 +175,11 @@ class PayStripeApi |
|
|
|
$chargeId = $eventData['id'];
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
throw new Exception('Unhandled event type: ' . $eventType);
|
|
|
|
throw new \Exception('Unhandled event type: ' . $eventType);
|
|
|
|
}
|
|
|
|
return $event;
|
|
|
|
} catch (Exception $e) {
|
|
|
|
throw new Exception('Webhook Error: ' . $e->getMessage());
|
|
|
|
throw new \Exception('Webhook Error: ' . $e->getMessage());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
...
|
...
|
|