如何使用Stripe's Webhook更新数据库中的用户?我有钩子工作只是无法让它更新数据库中的用户。
我如何在webhook什么时候打电话给客户customer.subscription.created & customer.subscription.updated & customer.subscription.deleted?
更新:我有这个..
require_once 'mainfile.php';
require_once 'config.php';
require_once 'Stripe/init.php';
// Retrieve the request's body and parse it as JSON
$input = file_get_contents("php://input");
$event = json_decode($input);
$customer_id = $event->data->object->customer;
$customer = \Stripe\Customer::retrieve($customer_id);
$email = $customer->email;
$start = $event->data->object->current_period_start;
$end = $event->data->object->current_period_end;
$status = $event->data->object->status;
if ($event->type == "customer.subscription.created") {
hook($email, $start, $end, $status);
}
if ($event->type == "customer.subscription.deleted") {
hook($email, $start, $end, $status);
}
if ($event->type == "customer.subscription.updated") {
hook($email, …Run Code Online (Sandbox Code Playgroud)