wwstripe

package
v0.14.1 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoWebhook = errors.Errorf("Stripe webhook does not exist")
View Source
var ErrNoWebhookSecret = errors.Errorf("FATAL: Webhook exists but webhook secret is not configured, find it at https://dashboard.stripe.com/")

Functions

This section is empty.

Types

type MigrateWebhookFailHandler added in v0.0.25

type MigrateWebhookFailHandler func(err error)

type Stripe

type Stripe struct {
	// contains filtered or unexported fields
}

func NewStripeFromEnv

func NewStripeFromEnv(log zerolog.Logger) (*Stripe, error)

func (*Stripe) Client

func (sApi *Stripe) Client() *client.API

func (*Stripe) CreateWebhook

func (sApi *Stripe) CreateWebhook(input WebhookInput) (*stripe.WebhookEndpoint, error)

func (*Stripe) MigrateWebhook

func (sApi *Stripe) MigrateWebhook(input WebhookInput, onFail MigrateWebhookFailHandler)

MigrateWebhook asynchronously checks stripe API for an existing webhook and updates the subscribed events if needed. onFail is called if a webhook for the given url does not exist or the webhook secret is not set.

func (*Stripe) PublicSettings added in v0.1.4

func (sApi *Stripe) PublicSettings() StripePublicSettings

func (*Stripe) WebUrl

func (sApi *Stripe) WebUrl(stripeId string) string

func (*Stripe) WebhookHandlerFunc

func (sApi *Stripe) WebhookHandlerFunc(onWebhook StripeEventHandler, onError func(err error)) http.HandlerFunc

type StripeEventHandler

type StripeEventHandler func(stripeApi *Stripe, event stripe.Event) ([]byte, error)

type StripePublicSettings added in v0.1.4

type StripePublicSettings struct {
	StripePublicKey string `json:"stripePublicKey"`
}

type WebhookInput

type WebhookInput struct {
	// Events to subscribe to i.e. checkout.session.completed,
	// payment_intent.succeeded, charge.refunded.
	// https://stripe.com/docs/api/events/types
	Events []string
	// The full url for the webhook i.e. https://example.com/webhook/stripe
	Url string
}

Jump to

Keyboard shortcuts

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