Skip to content

Instantly share code, notes, and snippets.

@callumj
Created December 12, 2014 22:28
Show Gist options
  • Save callumj/1636325d007c46e1b470 to your computer and use it in GitHub Desktop.
Save callumj/1636325d007c46e1b470 to your computer and use it in GitHub Desktop.
Stripe final invoice example
Params: {"id"=>"evt_15918WAOjoYioo6eh6ubIhG3", "created"=>1418420384, "livemode"=>false, "type"=>"invoice.payment_failed", "data"=>{"object"=>{"date"=>1418416740, "id"=>"in_1590BkAOjoYioo6e7zU6p7za", "period_start"=>1418416740, "period_end"=>1418416740, "lines"=>{"object"=>"list", "total_count"=>2, "has_more"=>false, "url"=>"/v1/invoices/in_1590BkAOjoYioo6e7zU6p7za/lines", "data"=>[{"id"=>"ii_1590BkAOjoYioo6eFYIKO43B", "object"=>"line_item", "type"=>"invoiceitem", "livemode"=>false, "amount"=>121999, "currency"=>"usd", "proration"=>false, "period"=>{"start"=>1418416740, "end"=>1418416740}, "subscription"=>nil, "quantity"=>nil, "plan"=>nil, "description"=>"Host 'rails-4198' 122 hours at 1000.00c/hour", "metadata"=>{}}, {"id"=>"ii_1590BkAOjoYioo6em1eascIv", "object"=>"line_item", "type"=>"invoiceitem", "livemode"=>false, "amount"=>136999, "currency"=>"usd", "proration"=>false, "period"=>{"start"=>1418416740, "end"=>1418416740}, "subscription"=>nil, "quantity"=>nil, "plan"=>nil, "description"=>"Host 'test2-9598' 137 hours at 1000.00c/hour", "metadata"=>{}}]}, "subtotal"=>258998, "total"=>258998, "customer"=>"cus_5IVkIXEYQdSOCk", "object"=>"invoice", "attempted"=>true, "closed"=>false, "forgiven"=>false, "paid"=>false, "livemode"=>false, "attempt_count"=>1, "amount_due"=>258998, "currency"=>"usd", "starting_balance"=>0, "ending_balance"=>0, "next_payment_attempt"=>nil, "webhooks_delivered_at"=>1418416751, "charge"=>"ch_15918WAOjoYioo6e7TG885vM", "discount"=>nil, "application_fee"=>nil, "subscription"=>nil, "metadata"=>{}, "statement_description"=>nil, "description"=>nil, "receipt_number"=>nil}}, "object"=>"event", "pending_webhooks"=>2, "request"=>nil, "api_version"=>"2014-12-08", "action"=>"hook", "controller"=>"application", "application"=>{"id"=>"evt_15918WAOjoYioo6eh6ubIhG3", "created"=>1418420384, "livemode"=>false, "type"=>"invoice.payment_failed", "data"=>{"object"=>{"date"=>1418416740, "id"=>"in_1590BkAOjoYioo6e7zU6p7za", "period_start"=>1418416740, "period_end"=>1418416740, "lines"=>{"object"=>"list", "total_count"=>2, "has_more"=>false, "url"=>"/v1/invoices/in_1590BkAOjoYioo6e7zU6p7za/lines", "data"=>[{"id"=>"ii_1590BkAOjoYioo6eFYIKO43B", "object"=>"line_item", "type"=>"invoiceitem", "livemode"=>false, "amount"=>121999, "currency"=>"usd", "proration"=>false, "period"=>{"start"=>1418416740, "end"=>1418416740}, "subscription"=>nil, "quantity"=>nil, "plan"=>nil, "description"=>"Host 'rails-4198' 122 hours at 1000.00c/hour", "metadata"=>{}}, {"id"=>"ii_1590BkAOjoYioo6em1eascIv", "object"=>"line_item", "type"=>"invoiceitem", "livemode"=>false, "amount"=>136999, "currency"=>"usd", "proration"=>false, "period"=>{"start"=>1418416740, "end"=>1418416740}, "subscription"=>nil, "quantity"=>nil, "plan"=>nil, "description"=>"Host 'test2-9598' 137 hours at 1000.00c/hour", "metadata"=>{}}]}, "subtotal"=>258998, "total"=>258998, "customer"=>"cus_5IVkIXEYQdSOCk", "object"=>"invoice", "attempted"=>true, "closed"=>false, "forgiven"=>false, "paid"=>false, "livemode"=>false, "attempt_count"=>1, "amount_due"=>258998, "currency"=>"usd", "starting_balance"=>0, "ending_balance"=>0, "next_payment_attempt"=>nil, "webhooks_delivered_at"=>1418416751, "charge"=>"ch_15918WAOjoYioo6e7TG885vM", "discount"=>nil, "application_fee"=>nil, "subscription"=>nil, "metadata"=>{}, "statement_description"=>nil, "description"=>nil, "receipt_number"=>nil}}, "object"=>"event", "pending_webhooks"=>2, "request"=>nil, "api_version"=>"2014-12-08"}}
Body: {
"id": "evt_15918WAOjoYioo6eh6ubIhG3",
"created": 1418420384,
"livemode": false,
"type": "invoice.payment_failed",
"data": {
"object": {
"date": 1418416740,
"id": "in_1590BkAOjoYioo6e7zU6p7za",
"period_start": 1418416740,
"period_end": 1418416740,
"lines": {
"object": "list",
"total_count": 2,
"has_more": false,
"url": "/v1/invoices/in_1590BkAOjoYioo6e7zU6p7za/lines",
"data": [
{
"id": "ii_1590BkAOjoYioo6eFYIKO43B",
"object": "line_item",
"type": "invoiceitem",
"livemode": false,
"amount": 121999,
"currency": "usd",
"proration": false,
"period": {
"start": 1418416740,
"end": 1418416740
},
"subscription": null,
"quantity": null,
"plan": null,
"description": "Host 'rails-4198' 122 hours at 1000.00c/hour",
"metadata": {
}
},
{
"id": "ii_1590BkAOjoYioo6em1eascIv",
"object": "line_item",
"type": "invoiceitem",
"livemode": false,
"amount": 136999,
"currency": "usd",
"proration": false,
"period": {
"start": 1418416740,
"end": 1418416740
},
"subscription": null,
"quantity": null,
"plan": null,
"description": "Host 'test2-9598' 137 hours at 1000.00c/hour",
"metadata": {
}
}
]
},
"subtotal": 258998,
"total": 258998,
"customer": "cus_5IVkIXEYQdSOCk",
"object": "invoice",
"attempted": true,
"closed": false,
"forgiven": false,
"paid": false,
"livemode": false,
"attempt_count": 1,
"amount_due": 258998,
"currency": "usd",
"starting_balance": 0,
"ending_balance": 0,
"next_payment_attempt": null,
"webhooks_delivered_at": 1418416751,
"charge": "ch_15918WAOjoYioo6e7TG885vM",
"discount": null,
"application_fee": null,
"subscription": null,
"metadata": {
},
"statement_description": null,
"description": null,
"receipt_number": null
}
},
"object": "event",
"pending_webhooks": 2,
"request": null,
"api_version": "2014-12-08"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment