How to Receive Webhook from Stripe in Java

后端 未结 4 1851
眼角桃花
眼角桃花 2021-02-06 10:13

I am trying to receive a webhook via a post request from Stripe Payments. The java method to process it looks like this:

@ResponseBody
@RequestMapping(    consu         


        
4条回答
  •  萌比男神i
    2021-02-06 10:32

    Here's what I did:

    The Java method still takes in the Event as a json String. Then I used Stripe's custom gson adapter and got the Event with:

    Event event = Event.gson.fromJson(stripeJsonEvent, Event.class);
    

    Where stripeJsonEvent is the string of json taken in by the webhook endpoint.

提交回复
热议问题