stripe

package
v1.0.7 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HealthChecker added in v1.0.6

func HealthChecker(provider ports.PaymentProvider) ports.HealthChecker

HealthChecker returns a Stripe payment provider checker or nil when provider is nil.

Types

type Config added in v1.0.6

type Config struct {
	Enabled           bool
	SecretKey         string
	WebhookSecret     string
	WebhookSkipVerify bool
	FrontendBaseURL   string
}

Config describes Stripe credentials and URLs.

func LoadConfig added in v1.0.6

func LoadConfig(loader *config.Loader) Config

LoadConfig reads Stripe config from environment.

type Option

type Option func(*Provider)

Option customizes Provider behavior.

func WithSkipVerify

func WithSkipVerify(skip bool) Option

WithSkipVerify allows skipping webhook signature verification (dev only).

type Provider

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

Provider implements ports.PaymentProvider using Stripe Checkout + webhooks.

func New

func New(secretKey, webhookSecret string, opts ...Option) *Provider

New returns a Stripe-backed payment provider.

func (*Provider) CreateBillingPortalSession added in v1.0.4

func (p *Provider) CreateBillingPortalSession(ctx context.Context, in ports.BillingPortalSessionInput) (ports.BillingPortalSession, error)

CreateBillingPortalSession creates a customer portal session.

func (*Provider) CreateCheckoutSession

func (p *Provider) CreateCheckoutSession(ctx context.Context, req ports.CheckoutSessionRequest) (ports.CheckoutSession, error)

CreateCheckoutSession creates a hosted checkout session for a single line item.

func (*Provider) CreateCustomer added in v1.0.4

func (p *Provider) CreateCustomer(ctx context.Context, in ports.CustomerInput) (ports.Customer, error)

CreateCustomer creates a Stripe customer.

func (*Provider) CreateInvoice added in v1.0.4

func (p *Provider) CreateInvoice(ctx context.Context, in ports.InvoiceInput) (ports.Invoice, error)

CreateInvoice creates a draft invoice for the customer.

func (*Provider) CreateInvoiceItem added in v1.0.4

func (p *Provider) CreateInvoiceItem(ctx context.Context, in ports.InvoiceItemInput) (ports.InvoiceItem, error)

CreateInvoiceItem creates a pending invoice item.

func (*Provider) CreateSetupIntent added in v1.0.4

func (p *Provider) CreateSetupIntent(ctx context.Context, in ports.SetupIntentInput) (ports.SetupIntent, error)

CreateSetupIntent creates a Stripe setup intent for saving payment methods.

func (*Provider) FinalizeInvoice added in v1.0.4

func (p *Provider) FinalizeInvoice(ctx context.Context, invoiceID string) (ports.Invoice, error)

FinalizeInvoice finalizes a draft invoice.

func (*Provider) ListPrices

func (p *Provider) ListPrices(ctx context.Context) ([]ports.Price, error)

ListPrices fetches active prices from Stripe.

func (*Provider) ParseWebhook

func (p *Provider) ParseWebhook(ctx context.Context, payload []byte, sigHeader string) (ports.WebhookEvent, error)

ParseWebhook verifies and parses the Stripe webhook payload.

func (*Provider) PayInvoice added in v1.0.4

func (p *Provider) PayInvoice(ctx context.Context, invoiceID string) (ports.Invoice, error)

PayInvoice attempts to pay an open invoice immediately using the customer's default payment method.

func (*Provider) RetrieveInvoice added in v1.0.4

func (p *Provider) RetrieveInvoice(ctx context.Context, invoiceID string) (ports.Invoice, error)

RetrieveInvoice fetches an invoice by ID.

func (*Provider) RetrieveInvoiceItem added in v1.0.4

func (p *Provider) RetrieveInvoiceItem(ctx context.Context, invoiceItemID string) (ports.InvoiceItem, error)

RetrieveInvoiceItem fetches an invoice item to see if it's already attached to an invoice.

func (*Provider) RetrievePaymentMethod added in v1.0.4

func (p *Provider) RetrievePaymentMethod(ctx context.Context, paymentMethodID string) (ports.PaymentMethod, error)

RetrievePaymentMethod fetches a stored payment method details.

func (*Provider) SetCustomerDefaultPaymentMethod added in v1.0.4

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

SetCustomerDefaultPaymentMethod updates the customer's default invoice payment method.

func (*Provider) UpdateCustomer added in v1.0.4

func (p *Provider) UpdateCustomer(ctx context.Context, customerID string, in ports.CustomerInput) error

UpdateCustomer updates an existing Stripe customer.

func (*Provider) UpdateInvoiceItem added in v1.0.5

func (p *Provider) UpdateInvoiceItem(ctx context.Context, invoiceItemID string, in ports.InvoiceItemUpdate) (ports.InvoiceItem, error)

UpdateInvoiceItem updates fields on a draft invoice item.

Jump to

Keyboard shortcuts

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