Debugging Stripe Webhook Event
PHP Snippet 1:
<?php
// Retrieve the request's body and parse it as JSON:
$input = @file_get_contents('php://input');
$event = json_decode($input);
http_response_code(200); // PHP 5.4 or greater
// echo the event id, evt_xxxyyyzzz
echo $event->id;
if($event->type == "charge.succeeded") {
// you want the id of the charge rather than the event, ch_xxxyyzz
echo $event->data->object->id;
}
?>