@RequestMapping(method = RequestMethod.POST, value = "/reward") @ResponseBody public String reward(HttpServletRequest request, HttpServletResponse response) throws IOException { JSONObject webhooks = Tools.getParams(request); logger.debug("webhooks info == " + webhooks); JSONObject charge = webhooks.getJSONObject("data").getJSONObject("object"); logger.debug("charge info == " + charge); String dealId = charge.getString("order_no"); logger.debug("deal id: " + dealId); if (charge.getBoolean("paid") == true) { Deal deal = new Deal(); deal.setDealId(dealId); deal.setDealStatus(true); dealService.updateDealRecord(deal); } Event event = Webhooks.eventParse(webhooks.toString()); if ("charge.succeeded".equals(event.getType())) { response.setStatus(200); } else if ("refund.succeeded".equals(event.getType())) { response.setStatus(200); } else { response.setStatus(500); } return "complete"; }