stripe

package
v0.8.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 21, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package stripe provides Stripe integration for the marketplace.

Index

Constants

This section is empty.

Variables

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

func VerifyWebhook

func VerifyWebhook(payload []byte, signature, secret string) (*stripe.Event, error)

VerifyWebhook verifies the Stripe webhook signature and returns the parsed event.

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

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

Jump to

Keyboard shortcuts

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