Documentation
¶
Index ¶
Constants ¶
const ( // ConfigEnvPrefix is the prefix applied to environment variables for configuring Stripe. ConfigEnvPrefix = config.ConfigEnvPrefix + "STRIPE_" )
Variables ¶
var ErrInvalidSubscription = errors.New("invalid subscription")
ErrInvalidSubscription indicates there was invalid data sent or received about a subscription.
Functions ¶
func CancelSubscription ¶
CancelSubscription will cancel a user's active subscription. Subscription will be cancelled at the end of the current billing period.
func HandleWebhook ¶
func HandleWebhook(res http.ResponseWriter, req *http.Request)
HandleWebhook will handle incoming webhook requests from Stripe, that are sent in response to events related to a user's subscription (like plan changes, trial expiry, payment events).
func StopPendingCancellation ¶
StopPendingCancellation will stop the pending cancellation of a user's subscription.
Types ¶
type Checkout ¶
type Checkout struct {
*stripe.CheckoutSession
}
Checkout is alocal wrapper around the stripe.CheckoutSession object.
type Config ¶
type Config struct {
// APIKey is the Stripe API key for communicating securely with the Stripe API.
APIKey string `koanf:"apikey" validate:"required"`
BaseURL string `koanf:"baseurl" validate:"required,url"`
WebHookSecret string `koanf:"webhooksecret" validate:"required"`
}
Config structure.
type PortalSession ¶
type PortalSession struct {
*stripe.BillingPortalSession
}
PortalSession is a local wrapper around the stripe.BillingPortalSession object.
func NewPortalSession ¶
func NewPortalSession(sessionID string) (*PortalSession, error)
NewPortalSession creates a new portal session, which allows a user to manage their subscription plan.