title: How to Receive Webhook from Stripe in Java
body: <p>I am trying to receive a webhook via a post request from Stripe Payments.  The java method to process it looks like this:</p>
  
  <pre><code>@ResponseBody
  @RequestMapping(    consumes="application/json",
                      produces="application/json",
                      method=RequestMethod.POST,
                      value="stripeWebhookEndpoint")
  public String stripeWebhookEndpoint(Event event){
  
      logger.info("\n\n" + event.toString());
  
      logger.info("\n\n" + event.getId());
  
      return null;
  }
  </code></pre>
  
  <p>But the <em>Stripe Event</em> always comes back with all null values:</p>
  
  <pre><code>&lt;com.stripe.model.Event@315899720 id=null&gt; JSON: {
    "id": null,
    "type": null,
    "user_id": null,
    "livemode": null,
    "created": null,
    "data": null,
    "pending_webhooks": null
  }
  </code></pre>
  
  <p>If the method receives a String instead,and using @RequestBody:</p>
  
  <pre><code>@ResponseBody
  @RequestMapping(    consumes="application/json",
                      produces="application/json",
                      method=RequestMethod.POST,
                      value="stripeWebhookEndpoint")
  public String stripeWebhookEndpoint(@RequestBody String json){
  
      logger.info(json);
  
      return null;
  }
  </code></pre>
  
  <p>Here, it prints the json without null values.  Here's part of the request being printed:</p>
  
  <pre><code>{
    "created": 1326853478,
    "livemode": false,
    "id": "evt_00000000000000",
    "type": "charge.succeeded",
    "object": "event",
    "request": null,
    "data": {
      "object": {
        "id": "ch_00000000000000",
        "object": "charge",
        "created": 1389985862,
        "livemode": false,
        "paid": true,
        "amount": 2995,
        "currency": "usd",
  ...
  }
  </code></pre>
  
  <p>But using @RequestBody with a <em>Stripe Event</em> parameter gives a 400: bad syntax.</p>
  
  <p>So why can't I take in the correct type, a <em>Stripe Event</em>, as the parameter?</p>