Skip to content

Instantly share code, notes, and snippets.

@ob-stripe
Created October 14, 2017 14:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ob-stripe/4502ca2b8edf52e1d7b93d792fbd8e75 to your computer and use it in GitHub Desktop.
Save ob-stripe/4502ca2b8edf52e1d7b93d792fbd8e75 to your computer and use it in GitHub Desktop.
<?php
require("./stripe-php/init.php");
$payload = <<<'EOT'
{
"created": 1326853478,
"livemode": false,
"id": "evt_00000000000000",
"type": "source.chargeable",
"object": "event",
"request": {
"id": null,
"idempotency_key": null
},
"pending_webhooks": 1,
"api_version": "2017-08-15",
"data": {
"object": {
"id": "src_00000000000000",
"object": "source",
"amount": 1000,
"client_secret": "src_client_secret_Ba0X1grvBpb66V9g84IeD6ir",
"created": 1507990933,
"currency": "usd",
"flow": "receiver",
"livemode": false,
"metadata": {},
"owner": {
"address": null,
"email": "jenny.rosen@example.com",
"name": null,
"phone": null,
"verified_address": null,
"verified_email": null,
"verified_name": null,
"verified_phone": null
},
"receiver": {
"address": "test_1MBhWS3uv4ynCfQXF3xQjJkzFPukr4K56N",
"amount_charged": 0,
"amount_received": 0,
"amount_returned": 0,
"refund_attributes_method": "email",
"refund_attributes_status": "missing"
},
"statement_descriptor": null,
"status": "pending",
"type": "bitcoin",
"usage": "single_use",
"bitcoin": {
"address": "test_1MBhWS3uv4ynCfQXF3xQjJkzFPukr4K56N",
"amount": 2371000,
"amount_charged": 0,
"amount_received": 0,
"amount_returned": 0,
"uri": "bitcoin:test_1MBhWS3uv4ynCfQXF3xQjJkzFPukr4K56N?amount=0.02371000"
}
}
}
}
EOT;
$data = json_decode($payload, true);
$event = \Stripe\Event::constructFrom($data, null);
echo($event);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment