TinyShip
TinyShip
 TinyShip
TinyShip
TinyShip Documentation
TinyShip User GuideGetting StartedBasic Configuration
Payment configurationStripeDodo Payments ConfigurationCreemPayPalWeChat PayAlipayDynamic PricingPayment testing
Credits System ConfigurationAffiliate System Configuration
Storage Service ConfigurationDatabase ConfigurationCaptcha Configuration
Development Best PracticesLocal E2E Workflow
User GuidePayment

Dodo Payments Configuration

Configure Dodo Payments

Dodo Payments is a global payment platform that operates as a Merchant of Record. It can handle tax, compliance, refunds, and related merchant obligations for developers, making it a good fit for SaaS and digital products sold globally.

Application Flow

  1. Register a Dodo Payments account

    • Visit the Dodo Payments website
    • Create an account and complete KYB or KYC verification
  2. Get API keys

    • Log in to the Dodo Payments Dashboard
    • Go to "Developer" → "API Keys"
    • Generate an API Key, usually starting with TSzsgjLa...
  3. Create products

    • Create products from the Dashboard "Products" page
    • Choose Recurring for subscriptions or One-Time for one-time payments
    • Configure price and currency
    • Copy the product ID, which starts with pdt_, and use it as dodoProductId
  4. Configure Webhooks

    • Go to "Developer" → "Webhooks"
    • Add the Webhook URL: https://yourdomain.com/api/payment/webhook/dodo
    • Select the payment and subscription event groups
    • Copy the Webhook Signing Key, which starts with whsec_

Environment Variables

Add the following to your .env file:

# Dodo Payments configuration
DODO_PAYMENTS_API_KEY=TSxxxxxxxxxx
DODO_PAYMENTS_WEBHOOK_KEY=whsec_xxxxxxxxxx
DODO_PAYMENTS_TEST_MODE=true

Set DODO_PAYMENTS_TEST_MODE=true for test mode. In production, set it to false and use production API and Webhook keys.

Webhook Configuration

Required Events

Select these event groups in the Dodo Dashboard:

  • payment: payment events
    • payment.succeeded: payment succeeded for one-time payments and credits
    • payment.failed: payment failed
  • subscription: subscription events
    • subscription.active: subscription activated
    • subscription.renewed: subscription renewed
    • subscription.cancelled: subscription cancelled
    • subscription.expired: subscription expired
    • subscription.on_hold: subscription paused
    • subscription.updated: subscription updated
    • subscription.plan_changed: subscription plan changed

Plan Configuration Examples

The config/payment.ts examples below apply only to static pricing (the default). With dynamic pricing, you do not need to edit config/payment.ts. Create plans in the admin panel at /admin/pricing and fill in the product IDs there.

Recurring Subscription

config/payment.ts
monthlyDodo: {
  provider: 'dodo',
  id: 'monthlyDodo',
  amount: 10,
  currency: 'USD',
  duration: {
    months: 1,
    type: 'recurring'
  },
  dodoProductId: 'pdt_xxxxxxxxxxxxxxxxxxxxx',
  i18n: {
    'en': {
      name: 'Dodo Monthly Plan',
      description: 'Monthly recurring subscription via Dodo Payments',
      duration: 'month',
      features: ['All premium features', 'Priority support']
    },
  }
}

One-Time Payment

config/payment.ts
monthlyDodoOneTime: {
  provider: 'dodo',
  id: 'monthlyDodoOneTime',
  amount: 10,
  currency: 'USD',
  duration: {
    months: 1,
    type: 'one_time'
  },
  dodoProductId: 'pdt_xxxxxxxxxxxxxxxxxxxxx',
  i18n: {
    'en': {
      name: 'Dodo Monthly Plan (One Time)',
      description: 'One-time payment for monthly access via Dodo Payments',
      duration: 'month',
      features: ['All premium features', 'Priority support']
    },
  }
}

Credits

config/payment.ts
creditsDodo: {
  provider: 'dodo',
  id: 'creditsDodo',
  amount: 5,
  currency: 'USD',
  duration: { type: 'credits' },
  credits: 100,
  dodoProductId: 'pdt_xxxxxxxxxxxxxxxxxxxxx',
  i18n: {
    'en': {
      name: '100 Credits Dodo',
      description: 'Purchase 100 AI credits via Dodo Payments',
      duration: 'one-time',
      features: ['100 AI conversations', '100 image generations']
    },
  }
}

Back to Payment Configuration

Stripe

Configure Stripe payments

Creem

Configure Creem payments

On this page

Application FlowEnvironment VariablesWebhook ConfigurationRequired EventsPlan Configuration ExamplesRecurring SubscriptionOne-Time PaymentCredits