PinStripe.WebhookHandler (PinStripe v0.4.0)
View SourceSpark DSL for defining webhook handlers.
This module provides a DSL for defining handlers for Stripe webhook events.
It is primarily used internally by PinStripe.WebhookController.
Example
defmodule MyApp.StripeWebhookHandlers do
use PinStripe.WebhookHandler
handle "customer.created", fn event ->
# Process customer.created event
:ok
end
handle "charge.succeeded", MyApp.ChargeHandler
endHandlers can be either:
- Anonymous functions that take the event as an argument
- Module names that implement a
handle_event/1function
Options
:extensions(list of module that adoptsSpark.Dsl.Extension) - A list of DSL extensions to add to theSpark.Dsl:otp_app(atom/0) - The otp_app to use for any application configurable options:fragments(list ofmodule/0) - Fragments to include in theSpark.Dsl. See the fragments guide for more.