package stripe import ( "fmt" "os" "github.com/stripe/stripe-go/v81" "github.com/stripe/stripe-go/v81/account" ) // Initialize sets up the Stripe client with the provided API key func Initialize() error { apiKey := os.Getenv("STRIPE_SECRET_KEY") if apiKey == "" { return fmt.Errorf("STRIPE_SECRET_KEY environment variable is not set") } // Set the API key for the Stripe client stripe.Key = apiKey // Test the connection acc, err := account.Get() if err != nil { return fmt.Errorf("failed to connect to Stripe: %v", err) } fmt.Printf("Stripe account: %+v\n", acc) return nil }