stripity_stripe v2.0.1 Stripe.Webhook

Creates a Stripe 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 Stripe.Event struct.

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

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

end

Link to this section Summary

Link to this section Functions

Link to this function construct_event(payload, signature_header, secret, tolerance \\ 300)
Link to this function convert_to_event!(payload)