events

package
v0.0.0-...-0a1f4b4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 28, 2016 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EventHandlers = make(map[string]eventHandler)

EventHandlers is a mapping of stripe events to their handleEvent functions

View Source
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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL