payment

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: May 11, 2026 License: AGPL-3.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsLocalhostURL added in v0.1.1

func IsLocalhostURL(baseURL string) bool

IsLocalhostURL returns true if the URL points to a local address. Stripe cannot deliver webhooks to localhost.

Types

type StripeHandler

type StripeHandler struct {
	Store         *store.Store
	WebhookSecret string // initial value from config (backward compat)
	BaseURL       string
	Email         *service.EmailService
	WebhookSvc    *service.WebhookService
	// Livemode is the environment this handler is configured for.
	// Every inbound webhook event whose Livemode differs is rejected
	// with 400 — guards against cross-environment delivery (test
	// secret leaking + replay into prod, or vice versa).
	Livemode bool
	// contains filtered or unexported fields
}

func (*StripeHandler) CancelSubscription

func (h *StripeHandler) CancelSubscription(c *gin.Context)

func (*StripeHandler) ChangePlan

func (h *StripeHandler) ChangePlan(c *gin.Context)

func (*StripeHandler) CheckoutByPlan added in v0.1.1

func (h *StripeHandler) CheckoutByPlan(c *gin.Context)

CheckoutByPlan handles GET /pay/:checkout_id — looks up plan by checkout_id, creates a Stripe Checkout Session, and redirects to Stripe.

func (*StripeHandler) CreateCheckoutSession

func (h *StripeHandler) CreateCheckoutSession(c *gin.Context)

func (*StripeHandler) CreatePortalSession

func (h *StripeHandler) CreatePortalSession(c *gin.Context)

CreatePortalSession creates a Stripe billing portal session for the user to manage payment methods.

func (*StripeHandler) GetWebhookSecret added in v0.1.1

func (h *StripeHandler) GetWebhookSecret() string

GetWebhookSecret returns the current webhook signing secret (thread-safe).

func (*StripeHandler) ListInvoices

func (h *StripeHandler) ListInvoices(c *gin.Context)

ListInvoices returns invoice history for a license's Stripe customer.

func (*StripeHandler) SetWebhookSecret added in v0.1.1

func (h *StripeHandler) SetWebhookSecret(secret string)

SetWebhookSecret updates the webhook signing secret (thread-safe).

func (*StripeHandler) SetupWebhookEndpoint added in v0.1.1

func (h *StripeHandler) SetupWebhookEndpoint(ctx context.Context)

SetupWebhookEndpoint ensures a Stripe webhook endpoint is configured. It runs synchronously on first attempt, then retries in the background if it fails.

func (*StripeHandler) SyncRecentCheckouts added in v0.1.1

func (h *StripeHandler) SyncRecentCheckouts(ctx context.Context)

SyncRecentCheckouts scans Stripe for completed checkout sessions in the last interval and creates licenses for any that were missed by webhooks.

func (*StripeHandler) VerifyCheckoutSession added in v0.1.1

func (h *StripeHandler) VerifyCheckoutSession(c *gin.Context)

VerifyCheckoutSession handles GET /api/v1/checkout/verify?session_id=xxx Called by the success page to verify payment and create license (webhook fallback).

func (*StripeHandler) Webhook

func (h *StripeHandler) Webhook(c *gin.Context)

Jump to

Keyboard shortcuts

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