Documentation ¶
Index ¶
- Variables
- type StripeClient
- func (s *StripeClient) DecodeEvent(payload []byte, signatureHeader string) (*stripe.Event, error)
- func (s *StripeClient) GetInfoFromEvent(event stripe.Event) (*stripe.Customer, *stripe.Subscription, error)
- func (s *StripeClient) GetPlans() ([]*db.Plan, error)
- func (s *StripeClient) GetPriceByID(priceID string) *stripe.Price
- func (s *StripeClient) GetPrices(priceIDs []string) []*stripe.Price
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) GetPriceByID ¶
func (s *StripeClient) GetPriceByID(priceID string) *stripe.Price
func (*StripeClient) GetPrices ¶
func (s *StripeClient) GetPrices(priceIDs []string) []*stripe.Price
Click to show internal directories.
Click to hide internal directories.