Php 条带webhook事件不工作

Php 条带webhook事件不工作,php,stripe-payments,webhooks,Php,Stripe Payments,Webhooks,我正在尝试在客户注册计划后发送电子邮件 我已经在stripe中设置了webhook,但它没有发送电子邮件 我做错了什么,这是webhook文件 <?php require 'core/lib/Stripe.php'; Stripe::setApiKey("YOUR_SECRET_KEY"); // retrieve the request's body and parse it as JSON $body = file_get_contents('php://input'); $ev

我正在尝试在客户注册计划后发送电子邮件

我已经在stripe中设置了webhook,但它没有发送电子邮件

我做错了什么,这是webhook文件

<?php

require 'core/lib/Stripe.php';

Stripe::setApiKey("YOUR_SECRET_KEY");

// retrieve the request's body and parse it as JSON
$body = file_get_contents('php://input');
$event_json = json_decode($body);

// for extra security, retrieve from the Stripe API
$event_id = $event_json->id;
$event = Stripe_Event::retrieve($event_id);

// This will send receipts on successful charges
if ($event_json->type == 'charge.succeeded') {

    $To = 'myemail@email.com'; 
    $Subject = 'Stripe Message'; 
    $Message = 'Webhook worked'; 
    $Headers = "From: coolio@yahoo.com \r\n" . 
    "Reply-To: coolio@yahoo.com \r\n" . 
    "Content-type: text/html; charset=UTF-8 \r\n"; 
    mail($To, $Subject, $Message, $Headers);

}

http_response_code(200); // PHP 5.4 or greater
?>

您可能希望从Stripe获取事件,以测试有效性并处理异常(注意,这在测试webhook时故意失败):

然后,您应该能够从以下类似的位置获取事件类型属性:

    if (isset($event) && $event->type == "charge.succeeded") {
      // Send your email
    }
    if (isset($event) && $event->type == "charge.succeeded") {
      // Send your email
    }