我試圖在收到來自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