· 9 years ago · Sep 16, 2016, 09:28 AM
1public function trigger_stripe(){
2 $stripe_keys = array(
3 "secret_key" => "sk_test_bwMnd0XXXXXXXX",
4 "publishable_key" => "pk_test_BHyBS8XvXXXXXXX7cFzVGDjlB"
5 );
6
7 $get = \Stripe\Stripe::setApiKey($stripe_keys["secret_key"]);
8
9 // Retrieve the request's body and parse it as JSON
10 $input = @file_get_contents("php://input");
11 $event_json = json_decode($input);
12
13 // Verify the event by fetching it from Stripe
14 $event = \Stripe\Event::retrieve($event_json->id);
15 echo $event;
16
17 // Do something with $event
18
19 http_response_code(200); // PHP 5.4 or greater
20
21 }