Documentation
¶
Overview ¶
Package paddle provides a stub implementation of the PaymentProvider interface for Paddle. This is a placeholder for future implementation.
Index ¶
- Variables
- type Config
- type Provider
- func (p *Provider) AttachPaymentMethod(ctx context.Context, customerID, paymentMethodID string) error
- func (p *Provider) CancelSubscription(ctx context.Context, subscriptionID string, immediately bool) error
- func (p *Provider) CreateBillingPortalSession(ctx context.Context, customerID, returnURL string) (string, 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) CreatePrice(ctx context.Context, plan *core.Plan) (string, error)
- func (p *Provider) CreateProduct(ctx context.Context, name, description string) (string, error)
- func (p *Provider) CreateSetupIntent(ctx context.Context, customerID string) (string, string, error)
- func (p *Provider) CreateSubscription(ctx context.Context, customerID, priceID string, quantity, trialDays int, ...) (string, error)
- func (p *Provider) DetachPaymentMethod(ctx context.Context, paymentMethodID string) error
- func (p *Provider) GeneratePayLink(ctx context.Context, productID string, prices map[string]float64, ...) (string, error)
- func (p *Provider) GetCustomer(ctx context.Context, customerID string) (interface{}, error)
- func (p *Provider) GetInvoice(ctx context.Context, invoiceID string) (*types.ProviderInvoice, 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) GetSubscriptionPayments(ctx context.Context, subscriptionID string) ([]interface{}, error)
- func (p *Provider) GetSubscriptionUsers(ctx context.Context, subscriptionID string) ([]interface{}, error)
- func (p *Provider) HandleWebhook(ctx context.Context, payload []byte, signature string) (*types.WebhookEvent, error)
- func (p *Provider) ListInvoices(ctx context.Context, customerID string, limit int) ([]*types.ProviderInvoice, error)
- func (p *Provider) ListPaymentMethods(ctx context.Context, customerID string) ([]interface{}, 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, subscriptionID, metricKey string, quantity int64, ...) 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) UpdateCustomer(ctx context.Context, customerID string, updates map[string]interface{}) error
- func (p *Provider) UpdatePrice(ctx context.Context, priceID string, updates map[string]interface{}) error
- func (p *Provider) UpdateSubscription(ctx context.Context, subscriptionID string, updates map[string]interface{}) error
- func (p *Provider) UpdateSubscriptionQuantity(ctx context.Context, subscriptionID string, quantity int) error
- func (p *Provider) VerifyWebhookSignature(payload []byte, signature string) bool
- func (p *Provider) VoidInvoice(ctx context.Context, invoiceID string) error
Constants ¶
This section is empty.
Variables ¶
var ErrNotImplemented = errors.New("paddle provider: not implemented")
ErrNotImplemented is returned when a method is not yet implemented
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
VendorID string `json:"vendorId"`
VendorAuthCode string `json:"vendorAuthCode"`
PublicKey string `json:"publicKey"`
WebhookSecret string `json:"webhookSecret"`
Sandbox bool `json:"sandbox"` // Use sandbox environment
}
Config holds Paddle-specific configuration
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider implements the PaymentProvider interface for Paddle This is a stub implementation - methods return ErrNotImplemented
func NewPaddleProvider ¶
NewPaddleProvider creates a new Paddle provider
func (*Provider) AttachPaymentMethod ¶
func (p *Provider) AttachPaymentMethod(ctx context.Context, customerID, paymentMethodID string) error
AttachPaymentMethod attaches a payment method
func (*Provider) CancelSubscription ¶
func (p *Provider) CancelSubscription(ctx context.Context, subscriptionID string, immediately bool) error
CancelSubscription cancels a subscription in Paddle
func (*Provider) CreateBillingPortalSession ¶
func (p *Provider) CreateBillingPortalSession(ctx context.Context, customerID, returnURL string) (string, error)
CreateBillingPortalSession creates a customer portal session Paddle has a different approach to customer management
func (*Provider) CreateCheckoutSession ¶
func (p *Provider) CreateCheckoutSession(ctx context.Context, req *types.CheckoutRequest) (*types.CheckoutSession, error)
CreateCheckoutSession creates a Paddle checkout session
func (*Provider) CreateCustomer ¶
func (p *Provider) CreateCustomer(ctx context.Context, email, name string, metadata map[string]interface{}) (string, error)
CreateCustomer creates a customer in Paddle Note: Paddle doesn't have explicit customer creation - customers are created on first purchase
func (*Provider) CreatePrice ¶
CreatePrice creates a price in Paddle
func (*Provider) CreateProduct ¶
CreateProduct creates a product in Paddle
func (*Provider) CreateSetupIntent ¶
func (p *Provider) CreateSetupIntent(ctx context.Context, customerID string) (string, string, error)
CreateSetupIntent creates a setup intent (not directly applicable to Paddle)
func (*Provider) CreateSubscription ¶
func (p *Provider) CreateSubscription(ctx context.Context, customerID, priceID string, quantity, trialDays int, metadata map[string]interface{}) (string, error)
CreateSubscription creates a subscription in Paddle Note: Paddle subscriptions are created via checkout
func (*Provider) DetachPaymentMethod ¶
DetachPaymentMethod detaches a payment method
func (*Provider) GeneratePayLink ¶
func (p *Provider) GeneratePayLink(ctx context.Context, productID string, prices map[string]float64, customerEmail string, passthrough map[string]interface{}) (string, error)
GeneratePayLink generates a Paddle pay link for checkout
func (*Provider) GetCustomer ¶
GetCustomer retrieves a customer from Paddle
func (*Provider) GetInvoice ¶
func (p *Provider) GetInvoice(ctx context.Context, invoiceID string) (*types.ProviderInvoice, error)
GetInvoice retrieves an invoice from Paddle
func (*Provider) GetProduct ¶
func (p *Provider) GetProduct(ctx context.Context, productID string) (*types.ProviderProduct, error)
GetProduct retrieves a single product from Paddle
func (*Provider) GetSubscription ¶
func (p *Provider) GetSubscription(ctx context.Context, subscriptionID string) (*types.ProviderSubscription, error)
GetSubscription retrieves a subscription from Paddle
func (*Provider) GetSubscriptionPayments ¶
func (p *Provider) GetSubscriptionPayments(ctx context.Context, subscriptionID string) ([]interface{}, error)
GetSubscriptionPayments retrieves payments for a subscription
func (*Provider) GetSubscriptionUsers ¶
func (p *Provider) GetSubscriptionUsers(ctx context.Context, subscriptionID string) ([]interface{}, error)
GetSubscriptionUsers lists users for a subscription
func (*Provider) HandleWebhook ¶
func (p *Provider) HandleWebhook(ctx context.Context, payload []byte, signature string) (*types.WebhookEvent, error)
HandleWebhook handles a Paddle webhook
func (*Provider) ListInvoices ¶
func (p *Provider) ListInvoices(ctx context.Context, customerID string, limit int) ([]*types.ProviderInvoice, error)
ListInvoices lists invoices for a customer
func (*Provider) ListPaymentMethods ¶
func (p *Provider) ListPaymentMethods(ctx context.Context, customerID string) ([]interface{}, error)
ListPaymentMethods lists payment methods for a customer
func (*Provider) ListPrices ¶
func (p *Provider) ListPrices(ctx context.Context, productID string) ([]*types.ProviderPrice, error)
ListPrices lists all prices for a product from Paddle
func (*Provider) ListProducts ¶
ListProducts lists all products from Paddle
func (*Provider) PauseSubscription ¶
PauseSubscription pauses a subscription in Paddle
func (*Provider) ReportUsage ¶
func (p *Provider) ReportUsage(ctx context.Context, subscriptionID, metricKey string, quantity int64, timestamp time.Time, idempotencyKey string) error
ReportUsage reports usage to Paddle
func (*Provider) ResumeSubscription ¶
ResumeSubscription resumes a subscription in Paddle
func (*Provider) SetDefaultPaymentMethod ¶
func (p *Provider) SetDefaultPaymentMethod(ctx context.Context, customerID, paymentMethodID string) error
SetDefaultPaymentMethod sets the default payment method
func (*Provider) UpdateCustomer ¶
func (p *Provider) UpdateCustomer(ctx context.Context, customerID string, updates map[string]interface{}) error
UpdateCustomer updates a customer in Paddle
func (*Provider) UpdatePrice ¶
func (p *Provider) UpdatePrice(ctx context.Context, priceID string, updates map[string]interface{}) error
UpdatePrice updates a price in Paddle
func (*Provider) UpdateSubscription ¶
func (p *Provider) UpdateSubscription(ctx context.Context, subscriptionID string, updates map[string]interface{}) error
UpdateSubscription updates a subscription in Paddle
func (*Provider) UpdateSubscriptionQuantity ¶
func (p *Provider) UpdateSubscriptionQuantity(ctx context.Context, subscriptionID string, quantity int) error
UpdateSubscriptionQuantity updates the quantity of a subscription
func (*Provider) VerifyWebhookSignature ¶
VerifyWebhookSignature verifies a Paddle webhook signature