Documentation
¶
Overview ¶
Package stripe provides Stripe integration for the marketplace.
Index ¶
- Variables
- func VerifyWebhook(payload []byte, signature, secret string) (*stripe.Event, error)
- type CheckoutService
- type Config
- type ConnectAccount
- type ConnectService
- func (s *ConnectService) CreateAccountLink(ctx context.Context, accountID, refreshURL, returnURL string) (string, error)
- func (s *ConnectService) CreateConnectAccount(ctx context.Context, orgID uuid.UUID, email string) (*ConnectAccount, error)
- func (s *ConnectService) CreatePayout(ctx context.Context, accountID string, amountCents int64, currency string) (string, error)
- func (s *ConnectService) GetAccountBalance(ctx context.Context, accountID string) (int64, string, error)
- func (s *ConnectService) GetConnectAccount(ctx context.Context, accountID string) (*ConnectAccount, error)
Constants ¶
This section is empty.
Variables ¶
var WebhookEventTypes = []string{
"checkout.session.completed",
"customer.subscription.created",
"customer.subscription.updated",
"customer.subscription.deleted",
"invoice.paid",
"invoice.payment_failed",
"account.updated",
}
WebhookEventTypes lists the Stripe event types we handle.
Functions ¶
Types ¶
type CheckoutService ¶
type CheckoutService struct {
// contains filtered or unexported fields
}
CheckoutService implements marketplace.CheckoutService using Stripe.
func NewCheckoutService ¶
func NewCheckoutService(cfg Config, listings marketplace.ListingService, licenses marketplace.LicenseService, authzSync marketplace.AuthzSyncer) *CheckoutService
NewCheckoutService creates a new Stripe checkout service.
func (*CheckoutService) CreateCheckoutSession ¶
func (s *CheckoutService) CreateCheckoutSession(ctx context.Context, req marketplace.CheckoutRequest) (*marketplace.CheckoutSession, error)
CreateCheckoutSession creates a Stripe checkout session for a listing.
func (*CheckoutService) ProcessWebhook ¶
func (s *CheckoutService) ProcessWebhook(ctx context.Context, payload []byte, signature string) error
ProcessWebhook handles Stripe webhook events.
type Config ¶
type Config struct {
// SecretKey is the Stripe secret API key.
SecretKey string
// WebhookSecret is the Stripe webhook signing secret.
WebhookSecret string
// ConnectAccountID is the Stripe Connect account ID (optional, for platforms).
ConnectAccountID string
}
Config holds Stripe configuration.
type ConnectAccount ¶
type ConnectAccount struct {
// ID is the Stripe account ID.
ID string
// OrganizationID is the platform organization ID.
OrganizationID uuid.UUID
// Email is the account email.
Email string
// ChargesEnabled indicates if the account can accept charges.
ChargesEnabled bool
// PayoutsEnabled indicates if the account can receive payouts.
PayoutsEnabled bool
// DetailsSubmitted indicates if onboarding is complete.
DetailsSubmitted bool
}
ConnectAccount represents a Stripe Connect account for a seller.
type ConnectService ¶
type ConnectService struct {
// contains filtered or unexported fields
}
ConnectService provides Stripe Connect functionality for marketplace sellers.
func NewConnectService ¶
func NewConnectService(cfg Config) *ConnectService
NewConnectService creates a new Stripe Connect service.
func (*ConnectService) CreateAccountLink ¶
func (s *ConnectService) CreateAccountLink(ctx context.Context, accountID, refreshURL, returnURL string) (string, error)
CreateAccountLink creates an onboarding link for a Connect account.
func (*ConnectService) CreateConnectAccount ¶
func (s *ConnectService) CreateConnectAccount(ctx context.Context, orgID uuid.UUID, email string) (*ConnectAccount, error)
CreateConnectAccount creates a new Stripe Connect Express account for a seller.
func (*ConnectService) CreatePayout ¶
func (s *ConnectService) CreatePayout(ctx context.Context, accountID string, amountCents int64, currency string) (string, error)
CreatePayout initiates a payout to a Connect account.
func (*ConnectService) GetAccountBalance ¶
func (s *ConnectService) GetAccountBalance(ctx context.Context, accountID string) (int64, string, error)
GetAccountBalance retrieves the available balance for a Connect account.
func (*ConnectService) GetConnectAccount ¶
func (s *ConnectService) GetConnectAccount(ctx context.Context, accountID string) (*ConnectAccount, error)
GetConnectAccount retrieves a Connect account by ID.