stripe

package
v0.0.0-...-449d51e Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2024 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PricesLookupKeys = []string{
	"essential_annual_plan",
	"premium_annual_plan",
	"free_plan",
	"custom_annual_plan",
}

Functions

This section is empty.

Types

type StripeClient

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

StripeClient is a client for interacting with the Stripe API. It holds the necessary configuration such as the webhook secret.

func New

func New(apiSecret, webhookSecret string) *StripeClient

New creates a new instance of StripeClient with the provided API secret and webhook secret. It sets the Stripe API key to the provided apiSecret.

func (*StripeClient) DecodeEvent

func (s *StripeClient) DecodeEvent(payload []byte, signatureHeader string) (*stripe.Event, error)

DecodeEvent decodes a Stripe webhook event from the given payload and signature header.

func (*StripeClient) GetInfoFromEvent

func (s *StripeClient) GetInfoFromEvent(event stripe.Event) (*stripe.Customer, *stripe.Subscription, error)

GetInfoFromEvent processes a Stripe event to extract customer and subscription information.

func (*StripeClient) GetPlans

func (s *StripeClient) GetPlans() ([]*db.Plan, error)

func (*StripeClient) GetPriceByID

func (s *StripeClient) GetPriceByID(priceID string) *stripe.Price

func (*StripeClient) GetPrices

func (s *StripeClient) GetPrices(priceIDs []string) []*stripe.Price

Jump to

Keyboard shortcuts

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