Documentation
¶
Overview ¶
Package stripe provides Stripe payment provider implementation.
Index ¶
- type Provider
- func (p *Provider) AttachPaymentMethod(ctx context.Context, customerID, paymentMethodID string) error
- func (p *Provider) CancelSubscription(ctx context.Context, subscriptionID string, immediate bool) error
- func (p *Provider) CreateCheckoutSession(ctx context.Context, req *types.CheckoutRequest) (*types.CheckoutSession, error)
- func (p *Provider) CreateCustomer(ctx context.Context, email, name string, metadata map[string]interface{}) (string, error)
- func (p *Provider) CreatePortalSession(ctx context.Context, customerID, returnURL string) (string, error)
- func (p *Provider) CreateSetupIntent(ctx context.Context, customerID string) (*core.SetupIntentResult, error)
- func (p *Provider) CreateSubscription(ctx context.Context, customerID string, priceID string, quantity int, ...) (string, error)
- func (p *Provider) DeleteCustomer(ctx context.Context, customerID string) error
- func (p *Provider) DetachPaymentMethod(ctx context.Context, paymentMethodID string) error
- func (p *Provider) GetInvoice(ctx context.Context, invoiceID string) (*types.ProviderInvoice, error)
- func (p *Provider) GetInvoicePDF(ctx context.Context, invoiceID string) (string, error)
- func (p *Provider) GetPaymentMethod(ctx context.Context, paymentMethodID string) (*core.PaymentMethod, error)
- func (p *Provider) GetProduct(ctx context.Context, productID string) (*types.ProviderProduct, error)
- func (p *Provider) GetSubscription(ctx context.Context, subscriptionID string) (*types.ProviderSubscription, error)
- func (p *Provider) HandleWebhook(ctx context.Context, payload []byte, signature string) (*types.WebhookEvent, error)
- func (p *Provider) ListPrices(ctx context.Context, productID string) ([]*types.ProviderPrice, error)
- func (p *Provider) ListProducts(ctx context.Context) ([]*types.ProviderProduct, error)
- func (p *Provider) Name() string
- func (p *Provider) PauseSubscription(ctx context.Context, subscriptionID string) error
- func (p *Provider) ReportUsage(ctx context.Context, subscriptionItemID string, records []*core.UsageRecord) (string, error)
- func (p *Provider) ResumeSubscription(ctx context.Context, subscriptionID string) error
- func (p *Provider) SetDefaultPaymentMethod(ctx context.Context, customerID, paymentMethodID string) error
- func (p *Provider) SyncAddOn(ctx context.Context, addon *core.AddOn) error
- func (p *Provider) SyncPlan(ctx context.Context, plan *core.Plan) error
- func (p *Provider) UpdateCustomer(ctx context.Context, customerID, email, name string, ...) error
- func (p *Provider) UpdateSubscription(ctx context.Context, subscriptionID string, priceID string, quantity int) error
- func (p *Provider) VoidInvoice(ctx context.Context, invoiceID string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider implements the PaymentProvider interface for Stripe
func NewStripeProvider ¶
NewStripeProvider creates a new Stripe provider
func (*Provider) AttachPaymentMethod ¶
func (p *Provider) AttachPaymentMethod(ctx context.Context, customerID, paymentMethodID string) error
AttachPaymentMethod attaches a payment method to a customer
func (*Provider) CancelSubscription ¶
func (p *Provider) CancelSubscription(ctx context.Context, subscriptionID string, immediate bool) error
CancelSubscription cancels a Stripe subscription
func (*Provider) CreateCheckoutSession ¶
func (p *Provider) CreateCheckoutSession(ctx context.Context, req *types.CheckoutRequest) (*types.CheckoutSession, error)
CreateCheckoutSession creates a Stripe checkout session
func (*Provider) CreateCustomer ¶
func (p *Provider) CreateCustomer(ctx context.Context, email, name string, metadata map[string]interface{}) (string, error)
CreateCustomer creates a Stripe customer
func (*Provider) CreatePortalSession ¶
func (p *Provider) CreatePortalSession(ctx context.Context, customerID, returnURL string) (string, error)
CreatePortalSession creates a Stripe billing portal session
func (*Provider) CreateSetupIntent ¶
func (p *Provider) CreateSetupIntent(ctx context.Context, customerID string) (*core.SetupIntentResult, error)
CreateSetupIntent creates a Stripe setup intent
func (*Provider) CreateSubscription ¶
func (p *Provider) CreateSubscription(ctx context.Context, customerID string, priceID string, quantity int, trialDays int, metadata map[string]interface{}) (string, error)
CreateSubscription creates a Stripe subscription
func (*Provider) DeleteCustomer ¶
DeleteCustomer deletes a Stripe customer
func (*Provider) DetachPaymentMethod ¶
DetachPaymentMethod detaches a payment method
func (*Provider) GetInvoice ¶
func (p *Provider) GetInvoice(ctx context.Context, invoiceID string) (*types.ProviderInvoice, error)
GetInvoice retrieves a Stripe invoice
func (*Provider) GetInvoicePDF ¶
GetInvoicePDF returns the PDF URL for an invoice
func (*Provider) GetPaymentMethod ¶
func (p *Provider) GetPaymentMethod(ctx context.Context, paymentMethodID string) (*core.PaymentMethod, error)
GetPaymentMethod retrieves a Stripe payment method
func (*Provider) GetProduct ¶
func (p *Provider) GetProduct(ctx context.Context, productID string) (*types.ProviderProduct, error)
GetProduct retrieves a single product from Stripe
func (*Provider) GetSubscription ¶
func (p *Provider) GetSubscription(ctx context.Context, subscriptionID string) (*types.ProviderSubscription, error)
GetSubscription retrieves a Stripe subscription
func (*Provider) HandleWebhook ¶
func (p *Provider) HandleWebhook(ctx context.Context, payload []byte, signature string) (*types.WebhookEvent, error)
HandleWebhook handles a Stripe webhook
func (*Provider) ListPrices ¶
func (p *Provider) ListPrices(ctx context.Context, productID string) ([]*types.ProviderPrice, error)
ListPrices lists all prices for a product from Stripe
func (*Provider) ListProducts ¶
ListProducts lists all products from Stripe, filtering for AuthSome-created products
func (*Provider) PauseSubscription ¶
PauseSubscription pauses a Stripe subscription
func (*Provider) ReportUsage ¶
func (p *Provider) ReportUsage(ctx context.Context, subscriptionItemID string, records []*core.UsageRecord) (string, error)
ReportUsage reports usage to Stripe
func (*Provider) ResumeSubscription ¶
ResumeSubscription resumes a Stripe subscription
func (*Provider) SetDefaultPaymentMethod ¶
func (p *Provider) SetDefaultPaymentMethod(ctx context.Context, customerID, paymentMethodID string) error
SetDefaultPaymentMethod sets the default payment method for a customer
func (*Provider) UpdateCustomer ¶
func (p *Provider) UpdateCustomer(ctx context.Context, customerID, email, name string, metadata map[string]interface{}) error
UpdateCustomer updates a Stripe customer