Documentation
¶
Index ¶
- Constants
- type Service
- func (s *Service) CancelSubscription(ctx context.Context, req *connect.Request[billingv1.CancelSubscriptionRequest]) (*connect.Response[billingv1.Subscription], error)
- func (s *Service) CreateSubscription(ctx context.Context, req *connect.Request[billingv1.CreateSubscriptionRequest]) (*connect.Response[billingv1.Subscription], error)
- func (s *Service) GetCreditBalance(ctx context.Context, req *connect.Request[billingv1.GetCreditBalanceRequest]) (*connect.Response[billingv1.CreditBalance], error)
- func (s *Service) GetCreditPack(ctx context.Context, req *connect.Request[billingv1.GetCreditPackRequest]) (*connect.Response[billingv1.CreditPack], error)
- func (s *Service) GetPlan(ctx context.Context, req *connect.Request[billingv1.GetPlanRequest]) (*connect.Response[billingv1.Plan], error)
- func (s *Service) GetPortalUrl(ctx context.Context, req *connect.Request[billingv1.GetPortalUrlRequest]) (*connect.Response[billingv1.PortalUrl], error)
- func (s *Service) GetSubscription(ctx context.Context, req *connect.Request[billingv1.GetSubscriptionRequest]) (*connect.Response[billingv1.Subscription], error)
- func (s *Service) ListCreditPacks(ctx context.Context, req *connect.Request[billingv1.ListCreditPacksRequest]) (*connect.Response[billingv1.ListCreditPacksResponse], error)
- func (s *Service) ListPlans(ctx context.Context, req *connect.Request[billingv1.ListPlansRequest]) (*connect.Response[billingv1.ListPlansResponse], error)
- func (s *Service) NewServiceHandler(opts ...connect.HandlerOption) (string, http.Handler)
- func (s *Service) NewWebhookHTTPHandler(pool *database.Pool) http.HandlerFunc
- func (s *Service) PurchaseCreditPack(ctx context.Context, req *connect.Request[billingv1.PurchaseCreditPackRequest]) (*connect.Response[billingv1.CreditBalance], error)
- func (s *Service) RegisterWebhookHandler(mux *http.ServeMux, pool *database.Pool)
- func (s *Service) UpdateSubscription(ctx context.Context, req *connect.Request[billingv1.UpdateSubscriptionRequest]) (*connect.Response[billingv1.Subscription], error)
Constants ¶
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 (*Service) CancelSubscription ¶
func (s *Service) CancelSubscription(ctx context.Context, req *connect.Request[billingv1.CancelSubscriptionRequest]) (*connect.Response[billingv1.Subscription], error)
CancelSubscription cancels a subscription
func (*Service) CreateSubscription ¶
func (s *Service) CreateSubscription(ctx context.Context, req *connect.Request[billingv1.CreateSubscriptionRequest]) (*connect.Response[billingv1.Subscription], error)
CreateSubscription creates a new subscription for an organization via Stripe Checkout
func (*Service) GetCreditBalance ¶
func (s *Service) GetCreditBalance(ctx context.Context, req *connect.Request[billingv1.GetCreditBalanceRequest]) (*connect.Response[billingv1.CreditBalance], error)
GetCreditBalance gets the credit balance for an organization
func (*Service) GetCreditPack ¶
func (s *Service) GetCreditPack(ctx context.Context, req *connect.Request[billingv1.GetCreditPackRequest]) (*connect.Response[billingv1.CreditPack], error)
GetCreditPack gets a specific credit pack (public endpoint - no auth required)
func (*Service) GetPlan ¶
func (s *Service) GetPlan(ctx context.Context, req *connect.Request[billingv1.GetPlanRequest]) (*connect.Response[billingv1.Plan], error)
GetPlan gets a specific subscription plan (public endpoint - no auth required)
func (*Service) GetPortalUrl ¶
func (s *Service) GetPortalUrl(ctx context.Context, req *connect.Request[billingv1.GetPortalUrlRequest]) (*connect.Response[billingv1.PortalUrl], error)
GetPortalUrl generates a Stripe billing portal URL
func (*Service) GetSubscription ¶
func (s *Service) GetSubscription(ctx context.Context, req *connect.Request[billingv1.GetSubscriptionRequest]) (*connect.Response[billingv1.Subscription], error)
GetSubscription gets the subscription for an organization
func (*Service) ListCreditPacks ¶
func (s *Service) ListCreditPacks(ctx context.Context, req *connect.Request[billingv1.ListCreditPacksRequest]) (*connect.Response[billingv1.ListCreditPacksResponse], error)
ListCreditPacks lists available credit packs (public endpoint - no auth required)
func (*Service) ListPlans ¶
func (s *Service) ListPlans(ctx context.Context, req *connect.Request[billingv1.ListPlansRequest]) (*connect.Response[billingv1.ListPlansResponse], error)
ListPlans lists available subscription plans (public endpoint - no auth required)
func (*Service) NewServiceHandler ¶
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 ¶
func (s *Service) PurchaseCreditPack(ctx context.Context, req *connect.Request[billingv1.PurchaseCreditPackRequest]) (*connect.Response[billingv1.CreditBalance], error)
PurchaseCreditPack purchases a credit pack
func (*Service) RegisterWebhookHandler ¶
RegisterWebhookHandler registers the custom webhook handler on the provided mux
func (*Service) UpdateSubscription ¶
func (s *Service) UpdateSubscription(ctx context.Context, req *connect.Request[billingv1.UpdateSubscriptionRequest]) (*connect.Response[billingv1.Subscription], error)
UpdateSubscription updates an existing subscription