decoding stripe json with json_decode not working

By : Tom
Source: Stackoverflow.com
Question!

I have json from stripe and I am trying to decode it json_decode.

I am not getting an error. Just nothing is returning. I am getting the data back from stripe, I just cant decode it.

{
   "created":1326853478,
   "data":{
      "object":{
         "amount":4500,
         "card":{
            "country":"US",
            "cvc_check":"pass",
            "exp_month":7,
            "exp_year":2014,
            "fingerprint":"9aQtfsI8a17zjEZd",
            "id":"cc_00000000000000",
            "last4":"9782",
            "object":"card",
            "type":"Visa"
         },
         "created":1322700852,
         "currency":"usd",
         "disputed":false,
         "fee":0,
         "id":"ch_00000000000000",
         "livemode":false,
         "object":"charge",
         "paid":true,
         "refunded":true
      }
   },
   "id":"evt_00000000000000",
   "livemode":false,
   "type":"charge.refunded"
}

// retrieve the request's body and parse it as JSON
$body = @file_get_contents('php://input');

$event_json = json_decode($body,true);
print_r($event_json);

Any ideas?

By : Tom


Answers

Here, I ran this:

By : citruspi


The php://input stream allows you to read raw data from the request body. This data will be a string and depending on what sort of values are in the request, will look something like:

"name=ok


This video can help you solving your question :)
By: admin