stripe

package
v0.5.28 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InAppPurchaseSuccess = "payment_intent.succeeded"
	InAppPurchaseFail    = "payment_intent.payment_failed"
)
View Source
const (
	CheckoutSeesionPaid              = "paid"                // 已支付
	CheckoutSeesionNoPaymentRequired = "no_payment_required" // 无需支付
	CheckoutSeesionUnpaid            = "unpaid"              // 未支付
)
View Source
const (
	RedirectTypeRedirect           = "redirect"
	RedirectTypeHostedConfirmation = "hosted_confirmation"
)
View Source
const (
	CheckoutSeesionCompleted = "checkout.session.completed"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BuildPaymentLinkConfig

type BuildPaymentLinkConfig struct {
	TradeNo     string
	Price       string
	Quantity    int
	Metadata    map[string]string
	RedirectURI string
}

type Option

type Option func(*Options)

func WithRedirectDomain added in v0.5.19

func WithRedirectDomain(redirectDomain string) Option

func WithRedirectType added in v0.5.18

func WithRedirectType(redirectType string) Option

func WithSecretKey

func WithSecretKey(secretKey string) Option

func WithWebhookSecret

func WithWebhookSecret(webhookSecret string) Option

type Options

type Options struct {
	SecretKey      string
	WebhookSecret  string
	RedirectType   string
	RedirectDomain string
}

type Stripe

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

func NewStripe

func NewStripe(opts ...Option) *Stripe

func (*Stripe) BuildPaymentLinkURL

func (s *Stripe) BuildPaymentLinkURL(conf *BuildPaymentLinkConfig) (string, error)

func (*Stripe) Provide

func (s *Stripe) Provide(ctx context.Context) any

func (*Stripe) VerifyPaymentIntentWebhook

func (s *Stripe) VerifyPaymentIntentWebhook(req *http.Request) (*stripe.CheckoutSession, error)

Jump to

Keyboard shortcuts

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