billing

package
v0.0.0-...-7ad5d0e Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PlanResourceType          = "plan"
	CreditPackResourceType    = "credit_pack"
	SubscriptionResourceType  = "subscription"
	CreditBalanceResourceType = "credit_balance"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Service

type Service struct {
	billingv1alpha1connect.UnimplementedBillingServiceHandler
	// contains filtered or unexported fields
}

Service implements the BillingService

func New

func New(log *logger.Logger, cfg *config.StripeConfig) (*Service, error)

New creates a new billing service

func (*Service) CancelSubscription

CancelSubscription cancels a subscription

func (*Service) CreateSubscription

CreateSubscription creates a new subscription for an organization via Stripe Checkout

func (*Service) GetCreditBalance

GetCreditBalance gets the credit balance for an organization

func (*Service) GetCreditPack

GetCreditPack gets a specific credit pack (public endpoint - no auth required)

func (*Service) GetPlan

GetPlan gets a specific subscription plan (public endpoint - no auth required)

func (*Service) GetPortalUrl

GetPortalUrl generates a Stripe billing portal URL

func (*Service) GetSubscription

GetSubscription gets the subscription for an organization

func (*Service) ListCreditPacks

ListCreditPacks lists available credit packs (public endpoint - no auth required)

func (*Service) ListPlans

ListPlans lists available subscription plans (public endpoint - no auth required)

func (*Service) NewServiceHandler

func (s *Service) NewServiceHandler(opts ...connect.HandlerOption) (string, http.Handler)

NewServiceHandler returns a connect service path and handler

func (*Service) NewWebhookHTTPHandler

func (s *Service) NewWebhookHTTPHandler(pool *database.Pool) http.HandlerFunc

NewWebhookHTTPHandler creates an HTTP handler for Stripe webhooks This is needed because Stripe sends raw body + signature header, not Connect RPC format

func (*Service) PurchaseCreditPack

PurchaseCreditPack purchases a credit pack

func (*Service) RegisterWebhookHandler

func (s *Service) RegisterWebhookHandler(mux *http.ServeMux, pool *database.Pool)

RegisterWebhookHandler registers the custom webhook handler on the provided mux

func (*Service) UpdateSubscription

UpdateSubscription updates an existing subscription

Jump to

Keyboard shortcuts

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