saas-payment-patterns

Solid

Payment provider abstraction, webhook security, subscription lifecycle, dunning flows, pricing models, invoicing, tax handling, and refund patterns for SaaS applications.

AI & Automation 496 stars 41 forks Updated 1 months ago MIT

Install

View on GitHub

Quality Score: 86/100

Stars 20%
90
Recency 20%
75
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# SaaS Payment Patterns Provider-agnostic payment patterns for subscription-based applications. Works with Stripe, Paddle, LemonSqueezy, or any billing provider. ## Payment Provider Abstraction Layer ```typescript // Abstract away the provider — swap Stripe for Paddle without touching business logic interface PaymentProvider { createCustomer(data: CreateCustomerDto): Promise<Customer> createSubscription(data: CreateSubscriptionDto): Promise<Subscription> cancelSubscription(subscriptionId: string, immediate?: boolean): Promise<void> createCheckoutSession(data: CheckoutDto): Promise<{ url: string }> issueRefund(paymentId: string, amountCents?: number): Promise<Refund> getInvoice(invoiceId: string): Promise<Invoice> verifyWebhookSignature(payload: string, signature: string): boolean } interface Customer { id: string; email: string; providerCustomerId: string } interface Subscription { id: string status: SubscriptionStatus planId: string currentPeriodEnd: Date cancelAtPeriodEnd: boolean } type SubscriptionStatus = 'trialing' | 'active' | 'past_due' | 'canceled' | 'expired' // Provider implementation (Stripe example) class StripePaymentProvider implements PaymentProvider { constructor(private stripe: Stripe) {} async createCustomer(data: CreateCustomerDto): Promise<Customer> { const stripeCustomer = await this.stripe.customers.create({ email: data.email, metadata: { internalUserId: data.userId } }) return { id: data....

Details

Author
vibeeval
Repository
vibeeval/vibecosystem
Created
2 months ago
Last Updated
1 months ago
Language
C#
License
MIT

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category