stripity_stripe v1.6.0 Stripe.Webhook

Creates an event from webhook’s payload if signature is valid.

Use construct_event/3 to verify the authenticity of a webhook request and convert its payload into a map representing the event.

case Stripe.Webhook.construct_event(payload, signature, secret) do

{:ok, event} ->
  # Return 200 to Stripe and handle event
{:error, reason} ->
  # Reject webhook by responding with non-2XX

end

Summary

Functions

construct_event(payload, signature_header, secret, tolerance \\ 300)