Development

    Implementing Dual Payment Gateways: Lemon Squeezy + Dodo Payments

    Dec 10, 2024
    15 min read
    PaymentsSaaSIntegrationTypeScript

    Why Multiple Payment Gateways?

    Selling globally means accepting payments locally. While Lemon Squeezy handles international payments beautifully, Indian customers prefer UPI and local cards. Enter Dodo Payments.

    Architecture Overview

    I built an abstraction layer that routes payments based on user location:

    interface PaymentProvider {
    

    createCheckout(options: CheckoutOptions): Promise;

    handleWebhook(payload: WebhookPayload): Promise;

    cancelSubscription(subscriptionId: string): Promise;

    }

    class LemonSqueezyProvider implements PaymentProvider {

    // Implementation

    }

    class DodoPaymentsProvider implements PaymentProvider {

    // Implementation

    }

    Lemon Squeezy Integration

    Perfect for international customers. Handles tax calculations, invoicing, and chargebacks automatically.

    Dodo Payments Setup

    For the Indian market - supports UPI, Indian credit/debit cards, and net banking with lower fees.

    Key Lessons

  1. Abstract payment logic behind interfaces
  2. Always handle webhook idempotency
  3. Test with real transactions early
  4. Keep subscription status synced across providers
  5. Related Articles

    Development

    Building Chrome Extensions That People Love: TryFitNow Case Study

    Featured

    A deep dive into building a Chrome extension for virtual try-on, from architecture decisions to user experience optimization...

    Nov 20, 2024
    11 min read
    Chrome ExtensionARJavaScript+1 more
    Read Article
    Development