title: Testing Stripe's webhooks - always an error
body: <p>I'm testing the web hooks in Stripe, I send an event from Stripe's website, here is my code:</p>
  
  <pre><code>require 'json'
  
  class StripeWebHooksController &lt; ApplicationController
    protect_from_forgery except: :webhook
  
    def webhook
      data_json = JSON.parse(request.body.read)
      event = Stripe::Event.retrieve(data_json['id'])
      #....
  </code></pre>
  
  <p>It always throws an exception:</p>
  
  <p><code>
  Stripe::InvalidRequestError (Could not determine which URL to request: Stripe::Event instance has invalid ID: nil)
  </code>
  On Stripes's website it says the id is 00000 for some reason, whereas in production.log it's not zeros, it has a real id. </p>
  
  <p><img src="https://i.stack.imgur.com/ZYvav.png" alt="enter image description here"></p>
  
  <p>Here is the data from Stripe.com:</p>
  
  <pre><code>{
    "created": 1326853478,
    "livemode": false,
    "id": "evt_00000000000000",
    "type": "charge.succeeded",
    "object": "event",
    "request": null,
    "pending_webhooks": 1,
    "api_version": "2015-02-10",
    "data": { # and so on....
  </code></pre>
  
  <p>And here's from production.log:</p>
  
  <pre><code>[- 8b95acf0-96ab-0132-4be7-42010af08843]   Parameters: {"id"=&gt;"evt_15VG6eKl7JrIRpD6md9wpwUu", "created"=&gt;1423721144, "livemode"=&gt;false, "type"=&gt;"invoice.created", "data"=&gt;{"object"=&gt;{"date"=&gt;1423721144, "id"=&gt;"in_15VG6eKl7JrIRpD6Nnd5hqm3", "period_start"=&gt;1423721144, "period_end"=&gt;1423721144, "lines"=&gt;{"object"=&gt;"list", "total_count"=&gt;1, "has_more"=&gt;false, "url"=&gt;"/v1/invoices/in_15VG6eKl7JrIRpD6Nnd5hqm3/lines", "data"=&gt;[{"id"=&gt;"sub_5gdNIr16MzaeUe", "object"=&gt;"line_item", "type"=&gt;"subscription", "livemode"=&gt;false, "amount"=&gt;28000, "currency"=&gt;"cad", "proration"=&gt;false, "period"=&gt;{"start"=&gt;1423721144, "end"=&gt;1426140344}, "subscription"=&gt;nil, "quantity"=&gt;1, "plan"=&gt;{"interval"=&gt;"month", "name"=&gt;"accelerated_test", "created"=&gt;1423705393, "amount"=&gt;28000, "currency"=&gt;"cad", "id"=&gt;"accelerated_test", "object"=&gt;"plan", "livemode"=&gt;false, "interval_count"=&gt;1, "trial_period_days"=&gt;nil, "metadata"=&gt;{}, "statement_descriptor"=&gt;nil, "statement_description"=&gt;nil}, "description"=&gt;nil, "metadata"=&gt;{}}]}, "subtotal"=&gt;28000, "total"=&gt;28000, "customer"=&gt;"cus_5gdN3daWCJVNzg", "object"=&gt;"invoice", "attempted"=&gt;true, "closed"=&gt;true, "forgiven"=&gt;false, "paid"=&gt;true, "livemode"=&gt;false, "attempt_count"=&gt;1, "amount_due"=&gt;28000, "currency"=&gt;"cad", "starting_balance"=&gt;0, "ending_balance"=&gt;0, "next_payment_attempt"=&gt;nil, "webhooks_delivered_at"=&gt;nil, "charge"=&gt;"ch_15VG6eKl7JrIRpD6nHI4iIdx", "discount"=&gt;nil, "application_fee"=&gt;nil, "subscription"=&gt;"sub_5gdNIr16MzaeUe", "tax_percent"=&gt;nil, "metadata"=&gt;{}, "statement_descriptor"=&gt;nil, "description"=&gt;nil, "receipt_number"=&gt;nil, "statement_description"=&gt;nil}}, "object"=&gt;"event", "pending_webhooks"=&gt;1, "request"=&gt;"iar_5gdNTJThO2GckT", "api_version"=&gt;"2014-11-20"}
  </code></pre>
  
  <p>Anyway, even if it's zeros, it doesn't have to raise an exception, does it? If it does, how do I test it after all?</p>