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
-
Register a Dodo Payments account
- Visit the Dodo Payments website
- Create an account and complete KYB or KYC verification
-
Get API keys
- Log in to the Dodo Payments Dashboard
- Go to "Developer" → "API Keys"
- Generate an API Key, usually starting with
TSzsgjLa...
-
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 asdodoProductId
-
Configure Webhooks
- Go to "Developer" → "Webhooks"
- Add the Webhook URL:
https://yourdomain.com/api/payment/webhook/dodo - Select the
paymentandsubscriptionevent 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=trueSet 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 creditspayment.failed: payment failed
- subscription: subscription events
subscription.active: subscription activatedsubscription.renewed: subscription renewedsubscription.cancelled: subscription cancelledsubscription.expired: subscription expiredsubscription.on_hold: subscription pausedsubscription.updated: subscription updatedsubscription.plan_changed: subscription plan changed
Plan Configuration Examples
Recurring Subscription
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
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
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