I am trying to handle webhook from stripe.
Stripe sends Webhook data is sent as JSON in the POST request body.
so I need to define endpoint in router.ex file but I don’t need a template and view,
then Do I have to define under
pipeline :api do
plug :accepts, ["json"]
end
this section?
and how can I return Http response 200? like python does
As Phoenix is another MVC framework, according to its convention such an endpoint should be defined in a controller not in the router file. For example:
scope "/api", YourApp do
pipe_through :api
post("/some-path", YourController, :index)
end