stripe

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2026 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package stripe provides Stripe payment provider implementation.

Index

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

func NewStripeProvider(secretKey, webhookSecret string) (*Provider, error)

NewStripeProvider creates a new Stripe provider

func (*Provider) AddSubscriptionItem added in v0.0.5

func (p *Provider) AddSubscriptionItem(ctx context.Context, subscriptionID string, priceID string, quantity int) (string, error)

AddSubscriptionItem adds an item (add-on) to an existing subscription

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

func (p *Provider) DeleteCustomer(ctx context.Context, customerID string) error

DeleteCustomer deletes a Stripe customer

func (*Provider) DeleteProviderFeature added in v0.0.5

func (p *Provider) DeleteProviderFeature(ctx context.Context, featureID string) error

DeleteProviderFeature deletes a feature from Stripe

func (*Provider) DetachPaymentMethod

func (p *Provider) DetachPaymentMethod(ctx context.Context, paymentMethodID string) error

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

func (p *Provider) GetInvoicePDF(ctx context.Context, invoiceID string) (string, error)

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) GetProviderFeature added in v0.0.5

func (p *Provider) GetProviderFeature(ctx context.Context, featureID string) (*types.ProviderFeature, error)

GetProviderFeature gets a specific feature 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) ListInvoices added in v0.0.5

func (p *Provider) ListInvoices(ctx context.Context, customerID string, limit int) ([]*types.ProviderInvoice, error)

ListInvoices lists invoices for a customer from Stripe

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

func (p *Provider) ListProducts(ctx context.Context) ([]*types.ProviderProduct, error)

ListProducts lists all products from Stripe, filtering for AuthSome-created products

func (*Provider) ListProviderFeatures added in v0.0.5

func (p *Provider) ListProviderFeatures(ctx context.Context, productID string) ([]*types.ProviderFeature, error)

ListProviderFeatures lists features from Stripe for a product

func (*Provider) ListSubscriptionInvoices added in v0.0.5

func (p *Provider) ListSubscriptionInvoices(ctx context.Context, subscriptionID string, limit int) ([]*types.ProviderInvoice, error)

ListSubscriptionInvoices lists invoices for a subscription from Stripe

func (*Provider) Name

func (p *Provider) Name() string

Name returns the provider name

func (*Provider) PauseSubscription

func (p *Provider) PauseSubscription(ctx context.Context, subscriptionID string) error

PauseSubscription pauses a Stripe subscription

func (*Provider) RemoveSubscriptionItem added in v0.0.5

func (p *Provider) RemoveSubscriptionItem(ctx context.Context, subscriptionID string, itemID string) error

RemoveSubscriptionItem removes an item from a 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

func (p *Provider) ResumeSubscription(ctx context.Context, subscriptionID string) error

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) SyncAddOn

func (p *Provider) SyncAddOn(ctx context.Context, addon *core.AddOn) error

SyncAddOn syncs an add-on to Stripe

func (*Provider) SyncFeature added in v0.0.5

func (p *Provider) SyncFeature(ctx context.Context, coreFeature *core.Feature) (string, error)

SyncFeature syncs a feature to Stripe as an Entitlement Feature

func (*Provider) SyncPlan

func (p *Provider) SyncPlan(ctx context.Context, plan *core.Plan) error

SyncPlan syncs a plan to Stripe (creates Product and Price)

func (*Provider) UpdateCustomer

func (p *Provider) UpdateCustomer(ctx context.Context, customerID, email, name string, metadata map[string]interface{}) error

UpdateCustomer updates a Stripe customer

func (*Provider) UpdateSubscription

func (p *Provider) UpdateSubscription(ctx context.Context, subscriptionID string, priceID string, quantity int) error

UpdateSubscription updates a Stripe subscription

func (*Provider) UpdateSubscriptionItem added in v0.0.5

func (p *Provider) UpdateSubscriptionItem(ctx context.Context, subscriptionID string, itemID string, quantity int) error

UpdateSubscriptionItem updates the quantity of a subscription item

func (*Provider) VoidInvoice

func (p *Provider) VoidInvoice(ctx context.Context, invoiceID string) error

VoidInvoice voids a Stripe invoice

Jump to

Keyboard shortcuts

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