【发布时间】:2015-02-04 13:47:44
【问题描述】:
我正在尝试在客户注册计划后发送电子邮件
我已将 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 中的事件时,它没有显示任何响应
【问题讨论】:
标签: php stripe-payments webhooks