1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Stripe webhook: can get event ID but not type

Discussion in 'PHP' started by qwikad.com, Mar 28, 2019.

  1. #1
    In my webhook when I put $event_id = $event_json->id; I get the event id (example: id:evt_1EJ1NdIcP22cq9aQWsTXf8DY).

    However, when I put $event_type = $event_json->type; I am expecting to get charge.succeeded or charge.failed, instead I am getting customer.source.created.

    I've searched the internet up and down, can't find the answer. What should I use to get what type of charge it was (charge.succeeded or charge.failed). Maybe someone can help me solve this one.

    To reiterate:
    <?php
    require_once('stripe/init.php');

    \Stripe\Stripe::setApiKey("sk_test_xxxxxxxxxxxxxxxxxxx");

    $input = @file_get_contents("php://input");

    $event_json = json_decode($input);

    // Get an ID just fine:
    $event_id = $event_json->id;

    // Should get charge.succeeded or charge.failed but it does not:
    $event_type = $event_json->type;

    ?>
     
    qwikad.com, Mar 28, 2019 IP