我试图在收到来自Stripe API的自定义帐户的account.updated调用时发送(简单测试)电子邮件。我的其他webhook创建收费并告知客户有关成功或失败的收费工作是这样的,但在这里我得到一个错误500(我可以看到在自定义帐户的仪表板中),并且邮件不发送,所以我不确定我在这里做错了什么。我的代码如下所示:stripe webhook account.updated无法正常工作
<?php
require_once('vendor/autoload.php');
// Set your secret key: remember to change this to your live secret key in production
// See your keys here: https://dashboard.stripe.com/account/apikeys
\Stripe\Stripe::setApiKey("sk_test_XXXX");
// Retrieve the request's body and parse it as JSON
$input = @file_get_contents("php://input");
$event_json = json_decode($input);
// Verify the event by fetching it from Stripe
$event = \Stripe\Event::retrieve($event_json->id);
// Do something with $event
if ($event->type == 'account.updated') {
// The E-Mail message to send to inform about a succeeded charge
$message = 'test';
// Send the E-Mail
mail('[email protected]', 'We need more info about you!', $message);
}
http_response_code(200); // PHP 5.4 or greater
感谢您的帮助!
谢谢,鸭,我没有通过该标识关联账户。它现在有效:-) – Dirkozoid