post(new Route("/webhooks") { @Override public Object handle(spark.Request request, Response response) { WebhookNotification webhookNotification = gateway.webhookNotification().parse( request.queryParams("bt_signature"), request.queryParams("bt_payload") ); // Example values for webhook notification properties System.out.println(webhookNotification.getKind()); // "subscription_went_past_due" System.out.println(webhookNotification.getTimestamp()); // "Sun Jan 1 00:00:00 UTC 2012" response.status(200); return(""); } });