Documentation
¶
Index ¶
- func HealthChecker(provider ports.PaymentProvider) ports.HealthChecker
- type Config
- type Option
- type Provider
- func (p *Provider) CreateBillingPortalSession(ctx context.Context, in ports.BillingPortalSessionInput) (ports.BillingPortalSession, error)
- func (p *Provider) CreateCheckoutSession(ctx context.Context, req ports.CheckoutSessionRequest) (ports.CheckoutSession, error)
- func (p *Provider) CreateCustomer(ctx context.Context, in ports.CustomerInput) (ports.Customer, error)
- func (p *Provider) CreateInvoice(ctx context.Context, in ports.InvoiceInput) (ports.Invoice, error)
- func (p *Provider) CreateInvoiceItem(ctx context.Context, in ports.InvoiceItemInput) (ports.InvoiceItem, error)
- func (p *Provider) CreateSetupIntent(ctx context.Context, in ports.SetupIntentInput) (ports.SetupIntent, error)
- func (p *Provider) FinalizeInvoice(ctx context.Context, invoiceID string) (ports.Invoice, error)
- func (p *Provider) ListPrices(ctx context.Context) ([]ports.Price, error)
- func (p *Provider) ParseWebhook(ctx context.Context, payload []byte, sigHeader string) (ports.WebhookEvent, error)
- func (p *Provider) PayInvoice(ctx context.Context, invoiceID string) (ports.Invoice, error)
- func (p *Provider) RetrieveInvoice(ctx context.Context, invoiceID string) (ports.Invoice, error)
- func (p *Provider) RetrieveInvoiceItem(ctx context.Context, invoiceItemID string) (ports.InvoiceItem, error)
- func (p *Provider) RetrievePaymentMethod(ctx context.Context, paymentMethodID string) (ports.PaymentMethod, error)
- func (p *Provider) SetCustomerDefaultPaymentMethod(ctx context.Context, customerID, paymentMethodID string) error
- func (p *Provider) UpdateCustomer(ctx context.Context, customerID string, in ports.CustomerInput) error
- func (p *Provider) UpdateInvoiceItem(ctx context.Context, invoiceItemID string, in ports.InvoiceItemUpdate) (ports.InvoiceItem, error)
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
LoadConfig reads Stripe config from environment.
type Option ¶
type Option func(*Provider)
Option customizes Provider behavior.
func WithSkipVerify ¶
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 (*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
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
FinalizeInvoice finalizes a draft invoice.
func (*Provider) ListPrices ¶
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
PayInvoice attempts to pay an open invoice immediately using the customer's default payment method.
func (*Provider) RetrieveInvoice ¶ added in v1.0.4
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.