subscription-integration
Build subscription billing into your app with Dodo Payments, handling trials, plan transitions, and usage-based pricing. Manage the full subscription lifecycle through webhook events—from activation through renewal and cancellation—with built-in customer portal support.
Subscription Integration helps you implement recurring billing with Dodo Payments, including trials, plan changes, and webhook event handling.
AI-generated summary based on this skill's SKILL.md
Install
dodopayments/skills/subscription-integration
git clone https://github.com/dodopayments/skills
cp -r skills/dodo-payments/subscription-integration ~/.claude/skills/subscription-integrationnpx skillfed install dodopayments/skills/subscription-integrationFrequently asked questions
AI-generated answers based on this skill's SKILL.md and metadata
How do I set up recurring billing with Dodo Payments?
subscription-integration enables recurring billing by creating subscription objects tied to your customer and plan. Define your billing cycle, trial period, and pricing model (fixed or usage-based) in your plan configuration. subscription-integration handles charge scheduling automatically and sends webhook events at each lifecycle milestone—creation, renewal, and cancellation—so your backend stays synchronized with billing state.
How does subscription-integration handle webhook events?
subscription-integration processes Dodo Payments subscription webhooks to keep your app in sync with billing changes. Key events include subscription.active (customer gains access), subscription.cancelled (revoke access), subscription.renewal (charge processed), and subscription.failed_payment (retry logic triggered). Your app listens for these events, updates customer entitlements, and manages access control based on subscription status.
Can I implement a trial period in subscription checkout?
Yes. subscription-integration lets you configure trial duration and trial pricing (often free or discounted) at plan creation. During the trial, the customer has full access but no charge occurs until the trial ends. On trial expiration, subscription-integration automatically transitions to paid billing and fires a subscription.active event so you can confirm the upgrade or handle payment failure.
How do I upgrade or downgrade a subscription plan?
subscription-integration supports mid-cycle plan changes through its upgrade/downgrade endpoints. When a customer switches plans, subscription-integration calculates proration—crediting unused time from the old plan or charging for the new plan's higher tier. The change takes effect immediately, and a webhook event notifies your backend so you can update customer entitlements and access permissions.
What happens when a subscription payment fails?
subscription-integration retries failed payments according to your grace period and retry policy. During the grace period, the customer retains access while Dodo Payments attempts collection. If payment succeeds, a subscription.renewal event fires. If all retries fail, subscription-integration sends subscription.failed_payment or subscription.cancelled, prompting your app to revoke access and notify the customer.
How does subscription-integration support usage-based billing?
subscription-integration tracks metered usage through usage events you report during the billing cycle. At renewal, subscription-integration calculates charges based on your usage tier or per-unit pricing and applies the total to the next invoice. This model works alongside fixed subscription fees, letting you bill for both base access and consumption. Webhooks confirm each usage-based charge.
SKILL.md
rendered from the published skill — quoted content, verbatim
Dodo Payments Subscription Integration
Reference: docs.dodopayments.com/developer-resources/subscription-integration-guide
Implement recurring billing with trials, plan changes, and usage-based pricing.
Quick Start
1. Create Subscription Product
In the dashboard (Products → Create Product): - Select "Subscription" type - Set billing interval (monthly, yearly, etc.) - Configure pricing
2. Create Checkout Session
```typescript import DodoPayments from 'dodopayments';
const client = new DodoPayments({ bearerToken: process.env.DODO_PAYMENTS_API_KEY, });
const session = await client.checkoutSessions.create({ product_cart: [ { product_id: 'prod_monthly_plan', quantity: 1 } ], subscription_data: { trial_period_days: 14, // Optional trial }, customer: { email: 'subscriber@example.com', name: 'Jane Doe', }, return_url: 'https://yoursite.com/success', });
// Redirect to
(truncated - see the full file via the links below)
Read as markdown · JSON record · Browse the source repository
File tree — 1 file
dodo-payments/subscription-integration/SKILL.md