Skip to content

Instantly share code, notes, and snippets.

@ryankinal
Created November 6, 2012 19:10
Show Gist options
  • Select an option

  • Save ryankinal/4026799 to your computer and use it in GitHub Desktop.

Select an option

Save ryankinal/4026799 to your computer and use it in GitHub Desktop.
Differences between Stripe docs
Actual "Event" webhook return (partial, decoded to PHP stdClass)
stdClass Object
(
[type] => invoice.payment_succeeded
[livemode] => 1
[pending_webhooks] => 1
[object] => event
[created] => 1352226885
[id] => evt_0geUCmQmZaf2OD
[data] => stdClass Object
(
[object] => stdClass Object
(
[livemode] => 1
[period_end] => 1352226884
[ending_balance] => 0
[attempt_count] => 0
[attempted] => 1
[lines] => stdClass Object
(
[subscriptions] => Array
(
[0] => stdClass Object
(
[type] => subscription
[proration] =>
[currency] => usd
[object] => line_item
[amount] => 2900
[plan] => stdClass Object
(
[interval] => month
[currency] => usd
[interval_count] => 1
[amount] => 2900
[object] => plan
[livemode] => 1
[name] => The Basic
[id] => 3
)
[period] => stdClass Object
(
[end] => 1354818884
[start] => 1352226884
)
[livemode] => 1
[id] => su_0geUbkZaWkuR6I
[quantity] => 1
[description] =>
)
)
)
[next_payment_attempt] =>
[object] => invoice
[subtotal] => 2900
[total] => 2900
[date] => 1352226884
[period_start] => 1352226884
[amount_due] => 2900
[id] => in_0geUuDks62HG3j
[paid] => 1
[currency] => usd
[starting_balance] => 0
[closed] => 1
[charge] => ch_0geUYXj2dy
API "Event" documentation:
Array(
"data" => Array(
[0] => {
"type": "invoice.payment_succeeded",
"livemode": false,
"created": 1352213896,
"object": "event",
"pending_webhooks": 1,
"id": "evt_0gazuRr4ExOMek",
"data": {
"object": {
"next_payment_attempt": null,
"period_end": 1352213896,
"livemode": false,
"total": 4900,
"lines": {
"subscriptions": [
{
"type": "subscription",
"proration": false,
"currency": "usd",
"object": "line_item",
"amount": 4900,
"plan": {
"interval": "month",
"currency": "usd",
"interval_count": 1,
"amount": 4900,
"object": "plan",
"livemode": false,
"name": "The Step Up",
"id": "17"
},
"period": {
"end": 1354805896,
"start": 1352213896
},
"livemode": false,
"id": "su_0gazVHtKusHYDQ",
"quantity": 1,
"description": null
}
]
},
"amount_due": 4900,
"object": "invoice",
"charge": "ch_0gazwDCPGjCUWM",
"starting_balance": 0,
"subtotal": 4900,
"attempted": true,
"date": 1352213896,
"ending_balance": 0,
"currency": "usd",
"period_start": 1352213896,
"id": "in_0gazGnqmMzrFzW",
"paid": true,
"customer": "cus_0gazCPeSu1AOeU",
"attempt_count": 0,
"closed": true
}
}
}
Test data:
{
"type": "invoice.payment_succeeded",
"object": "event",
"created": 1326853478,
"livemode": false,
"id": "evt_00000000000000",
"data": {
"object": {
"period_end": 1352213896,
"paid": true,
"amount_due": 4900,
"total": 4900,
"discount": null,
"attempted": true,
"currency": "usd",
"starting_balance": 0,
"lines": {
"url": "/v1/invoices/in_0gazGnqmMzrFzW/lines",
"count": 1,
"object": "list",
"data": [
{
"quantity": 1,
"type": "subscription",
"currency": "usd",
"proration": false,
"amount": 4900,
"object": "line_item",
"plan": {
"currency": "usd",
"interval": "month",
"amount": 900,
"object": "plan",
"livemode": false,
"interval_count": 1,
"trial_period_days": null,
"name": "The Shorty",
"id": "2"
},
"period": {
"end": 1357484296,
"start": 1354805896
},
"livemode": true,
"id": "su_0gazVHtKusHYDQ",
"description": null
}
]
},
"customer": "cus_00000000000000",
"ending_balance": 0,
"subtotal": 4900,
"object": "invoice",
"date": 1352213896,
"period_start": 1352213896,
"livemode": false,
"next_payment_attempt": null,
"id": "in_00000000000000",
"charge": "_00000000000000",
"closed": true,
"attempt_count": 0
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment