Documentation
¶
Overview ¶
Package paypal provides a stub implementation of the PaymentProvider interface for PayPal. 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) CaptureAuthorization(ctx context.Context, authorizationID string, amount float64, currency string) (string, 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) CreateWebhook(ctx context.Context, url string, eventTypes []string) (string, error)
- func (p *Provider) DeleteWebhook(ctx context.Context, webhookID string) error
- func (p *Provider) DetachPaymentMethod(ctx context.Context, paymentMethodID 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) GetSubscriptionTransactions(ctx context.Context, subscriptionID string, startTime, endTime time.Time) ([]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) RefundCapture(ctx context.Context, captureID string, amount float64, currency string) (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) ReviseSubscription(ctx context.Context, subscriptionID, newPlanID string) (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) VerifyWebhookSignature(ctx context.Context, webhookID string, headers map[string]string, ...) (bool, error)
- func (p *Provider) VoidInvoice(ctx context.Context, invoiceID string) error
Constants ¶
This section is empty.
Variables ¶
var ErrNotImplemented = errors.New("paypal provider: not implemented")
ErrNotImplemented is returned when a method is not yet implemented
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
ClientID string `json:"clientId"`
ClientSecret string `json:"clientSecret"`
WebhookID string `json:"webhookId"`
Sandbox bool `json:"sandbox"` // Use sandbox environment
}
Config holds PayPal-specific configuration
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider implements the PaymentProvider interface for PayPal This is a stub implementation - methods return ErrNotImplemented
func NewPayPalProvider ¶
NewPayPalProvider creates a new PayPal provider
func (*Provider) AttachPaymentMethod ¶
func (p *Provider) AttachPaymentMethod(ctx context.Context, customerID, paymentMethodID string) error
AttachPaymentMethod attaches a payment method (vault a token)
func (*Provider) CancelSubscription ¶
func (p *Provider) CancelSubscription(ctx context.Context, subscriptionID string, immediately bool) error
CancelSubscription cancels a subscription in PayPal
func (*Provider) CaptureAuthorization ¶
func (p *Provider) CaptureAuthorization(ctx context.Context, authorizationID string, amount float64, currency string) (string, error)
CaptureAuthorization captures a previously authorized payment
func (*Provider) CreateBillingPortalSession ¶
func (p *Provider) CreateBillingPortalSession(ctx context.Context, customerID, returnURL string) (string, error)
CreateBillingPortalSession - PayPal doesn't have equivalent
func (*Provider) CreateCheckoutSession ¶
func (p *Provider) CreateCheckoutSession(ctx context.Context, req *types.CheckoutRequest) (*types.CheckoutSession, error)
CreateCheckoutSession creates a subscription checkout link
func (*Provider) CreateCustomer ¶
func (p *Provider) CreateCustomer(ctx context.Context, email, name string, metadata map[string]interface{}) (string, error)
CreateCustomer creates a customer in PayPal (via vault)
func (*Provider) CreatePrice ¶
CreatePrice creates a billing plan in PayPal
func (*Provider) CreateProduct ¶
CreateProduct creates a product in PayPal (catalog product)
func (*Provider) CreateSetupIntent ¶
func (p *Provider) CreateSetupIntent(ctx context.Context, customerID string) (string, string, error)
CreateSetupIntent creates a setup token for payment method
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 PayPal
func (*Provider) CreateWebhook ¶
func (p *Provider) CreateWebhook(ctx context.Context, url string, eventTypes []string) (string, error)
CreateWebhook creates a webhook endpoint in PayPal
func (*Provider) DeleteWebhook ¶
DeleteWebhook deletes a webhook endpoint
func (*Provider) DetachPaymentMethod ¶
DetachPaymentMethod detaches a payment method
func (*Provider) GetCustomer ¶
GetCustomer retrieves a customer from PayPal
func (*Provider) GetInvoice ¶
func (p *Provider) GetInvoice(ctx context.Context, invoiceID string) (*types.ProviderInvoice, error)
GetInvoice retrieves a transaction from PayPal
func (*Provider) GetProduct ¶
func (p *Provider) GetProduct(ctx context.Context, productID string) (*types.ProviderProduct, error)
GetProduct retrieves a single product from PayPal
func (*Provider) GetSubscription ¶
func (p *Provider) GetSubscription(ctx context.Context, subscriptionID string) (*types.ProviderSubscription, error)
GetSubscription retrieves a subscription from PayPal
func (*Provider) GetSubscriptionTransactions ¶
func (p *Provider) GetSubscriptionTransactions(ctx context.Context, subscriptionID string, startTime, endTime time.Time) ([]interface{}, error)
GetSubscriptionTransactions lists transactions for a subscription
func (*Provider) HandleWebhook ¶
func (p *Provider) HandleWebhook(ctx context.Context, payload []byte, signature string) (*types.WebhookEvent, error)
HandleWebhook handles a PayPal webhook
func (*Provider) ListInvoices ¶
func (p *Provider) ListInvoices(ctx context.Context, customerID string, limit int) ([]*types.ProviderInvoice, error)
ListInvoices lists transactions for a subscription
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 PayPal
func (*Provider) ListProducts ¶
ListProducts lists all products from PayPal
func (*Provider) PauseSubscription ¶
PauseSubscription suspends a subscription in PayPal
func (*Provider) RefundCapture ¶
func (p *Provider) RefundCapture(ctx context.Context, captureID string, amount float64, currency string) (string, error)
RefundCapture refunds a captured payment
func (*Provider) ReportUsage ¶
func (p *Provider) ReportUsage(ctx context.Context, subscriptionID, metricKey string, quantity int64, timestamp time.Time, idempotencyKey string) error
ReportUsage reports usage (PayPal doesn't have native metered billing)
func (*Provider) ResumeSubscription ¶
ResumeSubscription reactivates a subscription in PayPal
func (*Provider) ReviseSubscription ¶
func (p *Provider) ReviseSubscription(ctx context.Context, subscriptionID, newPlanID string) (string, error)
ReviseSubscription revises a subscription plan (upgrade/downgrade)
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 PayPal
func (*Provider) UpdatePrice ¶
func (p *Provider) UpdatePrice(ctx context.Context, priceID string, updates map[string]interface{}) error
UpdatePrice updates a billing plan in PayPal
func (*Provider) UpdateSubscription ¶
func (p *Provider) UpdateSubscription(ctx context.Context, subscriptionID string, updates map[string]interface{}) error
UpdateSubscription updates a subscription in PayPal