TinyShip
TinyShip
 TinyShip
TinyShip
TinyShip Documentation
TinyShip User GuideGetting StartedBasic Configuration
Payment ConfigurationStripe ConfigurationPayPal ConfigurationWeChat Pay ConfigurationAlipay ConfigurationCreem ConfigurationDodo Payments ConfigurationPayment Testing
Credits 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

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']
    },
    'zh-CN': {
      name: 'Dodo 月度订阅',
      description: '通过 Dodo Payments 的月度循环订阅',
      duration: '月',
      features: ['所有高级功能', '优先支持']
    }
  }
}

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']
    },
    'zh-CN': {
      name: 'Dodo 月度 (一次性)',
      description: '通过 Dodo Payments 的一次性月度付费',
      duration: '月',
      features: ['所有高级功能', '优先支持']
    }
  }
}

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']
    },
    'zh-CN': {
      name: '100 积分包 Dodo',
      description: '通过 Dodo Payments 购买的 100 个 AI 积分',
      duration: '一次性',
      features: ['100 次 AI 对话', '100 次图片生成']
    }
  }
}

Back to Payment Configuration

Creem Configuration

Configure Creem cryptocurrency payment

Payment Testing

How to test payment functionality

On this page

Application FlowEnvironment VariablesWebhook ConfigurationRequired EventsPlan Configuration ExamplesRecurring SubscriptionOne-Time PaymentCredits