• Categories
    • PHP
    • phpMyAdmin
    • PHPMailer
    • FFMpeg
    • PHPEXcel
    • PHPDoc
    • PHPUnit
    • CakePHP
    • CakePHP 2.0
    • Cake PHP 2.1
    • CakePHP Model
    • Facebook PHP SDK
    • composer-php
    • PHP 7
    • PHP GD
    All Categories
  • About

Debugging Stripe Webhook Event

phpstripe-paymentswebhooks


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;
}

?>

Related Snippets

how to fix Service provider class not found when using repository?

How to connect to MSSQL Server with PHP from Ubuntu 18.04?

Laravel/docker-compose/redis - Class 'Redis' not found

Appending data to an anchor tag

How to convert time from one timezone to another in PHP

Laravel - Implicit route model binding with soft deleted data

How to find phpcs current default standard

Select option from dropdown menu with PHP and mySql

php code to send checkbox form results to email

Implode columnar values between two arrays into a flat array of concatenated strings

How to read laravel_session cookies saved in cookie memory of browser in client side?

How To Access A Column In M-M Relationship Table In Laravel

How in Laravel run JavaScript code stored in php variable?

How to use functions that are declared in snippets in Evolution CMS (Modx) in an external PHP Script?

how to prevent float variables displaying as scientific notation when printing [duplicate]

About Contact Privacy policy Terms and conditions