Çiçekçi Asistanı Docs
Çiçekçi Asistanı Docs
HomeAnother Page
Folder
Setting Up Your DatabaseSuper Admin
Dodo Payments Integration
SetupPayments

Dodo Payments Integration

Set up Dodo Payments for your Indie Kit application - API, webhooks, and plan mapping.

Dodo Payments Integration

Set up Dodo Payments for your Indie Kit application.

Initial Setup

  1. Create a Dodo Payments account
  2. Set up your business details
  3. Add required legal documents:
    • Privacy Policy
    • Terms of Service
  4. Add these environment variables to .env (template) and set real values in .env.local:
# Dodo Payments
DODO_PAYMENTS_API_URL="https://test.dodopayments.com"
DODO_PAYMENTS_API_KEY=""
DODO_PAYMENTS_WEBHOOK_SECRET=""

For production use https://live.dodopayments.com and your live API key.

Security Note

Never commit API key or webhook secret to your repository. Keep them in .env.local and in your hosting platform's environment variables.

Testing vs Production

Use test.dodopayments.com for testing and live.dodopayments.com for production.

Webhook Setup

  1. In Dodo Payments Dashboard, add your webhook endpoint:

    https://your-domain.com/api/webhooks/dodo
  2. For local testing, expose your app with ngrok and use that URL:

    ngrok http 3000

    Then set the webhook URL to https://your-ngrok-url.ngrok.io/api/webhooks/dodo.

  3. Enable these webhook events in the dashboard:

    • payment.succeeded, payment.failed, payment.processing, payment.cancelled
    • refund.succeeded, refund.failed
    • dispute.opened, dispute.expired, dispute.accepted, dispute.cancelled, dispute.challenged, dispute.won, dispute.lost
    • subscription.created, subscription.active, subscription.on_hold, subscription.renewed, subscription.paused, subscription.cancelled, subscription.failed, subscription.expired
    • license_key.created
    • customer.created

Important

The kit's webhook handler at /api/webhooks/dodo implements all of these. In production, set DODO_PAYMENTS_WEBHOOK_SECRET so requests are verified.

Plan Mapping

  1. In Dodo Dashboard, create products (monthly, yearly, one-time) and copy each Product ID.
  2. Go to super admin: /super-admin/plans.
  3. For each plan, set:
    • monthlyDodoProductId – Dodo product ID for monthly
    • yearlyDodoProductId – Dodo product ID for yearly
    • onetimeDodoProductId – Dodo product ID for one-time

Product IDs are in Dodo Dashboard under Products → select product.

Subscribe Buttons

Use the getSubscribeUrl helper to build checkout links:

import getSubscribeUrl, { PlanType, PlanProvider } from '@/lib/plans/getSubscribeUrl'

const monthlyUrl = getSubscribeUrl({
  codename: plan.codename,
  type: PlanType.MONTHLY,
  provider: PlanProvider.DODO,
  trialPeriodDays: 7
})

const yearlyUrl = getSubscribeUrl({
  codename: plan.codename,
  type: PlanType.YEARLY,
  provider: PlanProvider.DODO,
  trialPeriodDays: 14
})

const onetimeUrl = getSubscribeUrl({
  codename: plan.codename,
  type: PlanType.ONETIME,
  provider: PlanProvider.DODO
})

Credits Product (Optional)

If you sell credits via Dodo, create a product in Dodo and set in .env.local:

DODO_CREDITS_PRODUCT_ID="your_credits_product_id"

Features

  • Automatic plan upgrades/downgrades via webhooks
  • Dodo-managed billing and customer portal
  • Payment and subscription tracking
  • Credit purchases with metadata

Best Practices

  1. Testing: Use ngrok for local webhook tests; verify subscription and one-time flows.
  2. Production: Set DODO_PAYMENTS_WEBHOOK_SECRET, use live API URL and key, monitor webhook logs.
  3. Customer experience: Show clear pricing and trial info; link to billing portal for subscription management.

Your Indie Kit app is ready to accept payments and manage subscriptions with Dodo Payments.

Setting Up Resend

Set up Resend for reliable email delivery in your Indie Kit application.

On this page

Dodo Payments IntegrationInitial SetupWebhook SetupPlan MappingSubscribe ButtonsCredits Product (Optional)FeaturesBest Practices