如何使用Stripe的Webhook
来更新数据库中的用户?我已经让钩子起作用了,只是无法将其用于更新数据库中的用户。
当customer.subscription.created & customer.subscription.updated & customer.subscription.deleted
时,如何在webhook
中调用客户?
UPDATE: I have this..
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, $start, $end, $status);
}
?>
But now I get this error:
[05-Mar-2016 23:52:56 America/New_York] PHP Warning: mysqli_connect(): Headers and client library minor version mismatch. Headers:100023 Library:100106 in /home/sociagkf/public_html/dashboard/mainfile.php on line 25