• 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

Move a child array to parent array and change parent/child name

Twig - How to check if variable is a number / integer

enable Apache http Authorization header

PHP only Hit Counter?

WooCommerce - unset "<product> removed notice…" on cart page

Utf8 encoding issue with Laravel

Encrypt in php and decrypt in Dart(flutter)

Can we define variables in `.tpl` files?

how to remove %20 in the url in php

How to find phpcs current default standard

PHP password_verify

how to redirect the user back to desired URL after login page in PHP?

Elasticsearch - Want to sort by field in all indices where that particular field available or not if not then avoid it

Laravel PHP: multiple project run at the same time [closed]

Laravel 8 Multiple Relationships for Factory

About Contact Privacy policy Terms and conditions