paypal

package
v0.0.13 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: 6 Imported by: 0

Documentation

Overview

Package paypal provides a stub implementation of the PaymentProvider interface for PayPal. This is a placeholder for future implementation.

Index

Constants

This section is empty.

Variables

View Source
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

func NewPayPalProvider(config Config) (*Provider, error)

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

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

CreatePrice creates a billing plan in PayPal

func (*Provider) CreateProduct

func (p *Provider) CreateProduct(ctx context.Context, name, description string) (string, error)

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

func (p *Provider) DeleteWebhook(ctx context.Context, webhookID string) error

DeleteWebhook deletes a webhook endpoint

func (*Provider) DetachPaymentMethod

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

DetachPaymentMethod detaches a payment method

func (*Provider) GetCustomer

func (p *Provider) GetCustomer(ctx context.Context, customerID string) (interface{}, error)

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

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

ListProducts lists all products from PayPal

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

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

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

func (*Provider) VerifyWebhookSignature

func (p *Provider) VerifyWebhookSignature(ctx context.Context, webhookID string, headers map[string]string, payload []byte) (bool, error)

VerifyWebhookSignature verifies a PayPal webhook signature

func (*Provider) VoidInvoice

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

VoidInvoice voids an invoice

Jump to

Keyboard shortcuts

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