Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var EventHandlers = make(map[string]eventHandler)
EventHandlers is a mapping of stripe events to their handleEvent functions
var ValidationHandler validateHandler
ValidationHandler is an
Functions ¶
func RegisterEventHandler ¶
func RegisterEventHandler(event string, handleFunc eventHandler)
RegisterEventHandler adds the handler to the list of handlers It will overwrite handler if one exists for event already
func RegisterEventHandlers ¶
func RegisterEventHandlers()
RegisterEventHandlers is the place to add your handlers for each event type you want to support from Stripe webhooks
func RegisterValidationHandler ¶
func RegisterValidationHandler(handleFunc validateHandler)
RegisterValidationHandler allows you to add your validation handler function here A typical validation is to call back to Stripe and verify and use the event that check returns.
If you want no validation with Stripe, then just use the original event data e.g.
validationHandler = func(hook *stripe.Event) (*stripe.Event, error) { return &stripe.Event{ Data: &hook.Data, Live: hook.LiveMode, Type: hook.Type, ID: hook.Id, }, nil }
func VerifyEventWithStripe ¶
func VerifyEventWithStripe(hook *stripe.Event) (*stripe.Event, error)
VerifyEventWithStripe verifies the event received via webhook with Stripe using the ID to confirm webhook is legit - extra security step Note: If the stripe webhook is not Livemode then this bypasses the call to Stripe and uses the event we have from the original webhook. Without that bypass, a testmode hook would always fail this callback
Types ¶
This section is empty.