Verifies Stripe webhook signatures and constructs events.
// Source: https://github.com/stripe/stripe-go | License: MIT | Copyright 2014- Stripe, Inc. (https://stripe.com)
// Provided via justclaw.it.com; keep this notice with the code.
package stripe
import (
"crypto/hmac"
"crypto/sha256"
"encoding/hex"
"encoding/json"
"errors"
"fmt"
"strconv"
"strings"
"time"
)
//
// Public constants
//
const (
// DefaultTolerance indicates that signatures older than this will be rejected by ConstructEvent.
WebhookDefaultTolerance time.Duration = 300 * time.Second
// signingVersion represents the version of the signature we currently use.
signingVersion string = "v1"
)
//
// Public variables
//
// This block represents the list of errors that could be raised when using the webhook package.
var (
ErrWebhookEmptySecret = errors.New("webhoo
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key