Implementation: Available via npm package | Source Code: GitHub
What Can You Sync?
Our database sync feature supports synchronizing the following Dodo Payments entities to your database:Payments
Sync all payment transactions, including one-time payments, refunds, and payment status updates.
Customers
Keep your customer data in sync, including customer profiles, contact information, and metadata.
Subscriptions
Synchronize subscription data, including active subscriptions, billing cycles, and subscription status changes.
Licenses
Sync license information, including license keys, activations, and license status updates.
scopes parameter. All sync operations are incremental and only transfer new or updated records for optimal performance.
Database Support
We currently support MongoDB. We are actively working on expanding support for:- Databases: Postgres, Clickhouse, Snowflake, and others.
- Pipelines: ETL pipelines, Realtime sync.
Getting Started
You can use our database sync feature via the CLI or programmatically in your code. Both methods provide the same functionality—choose the one that best fits your workflow.Using the CLI
The CLI tool provides a quick way to set up and run database synchronization. Install it globally to use it from anywhere in your terminal:Running the CLI
The CLI supports two modes: Interactive Mode for guided setup, and Manual Mode for direct configuration. Interactive Mode: Simply run the command without arguments to start the interactive setup wizard.CLI Arguments
Sync interval in seconds. Determines how frequently the sync operation runs. If not provided, the sync will run once and exit.
Database type to use. Currently only
"mongodb" is supported.Connection URI for your database. For MongoDB, this should be a valid MongoDB connection string (e.g.,
mongodb://localhost:27017 or mongodb+srv://user:pass@cluster.mongodb.net/).Comma-separated list of data entities to sync. Available scopes:
licences, payments, customers, subscriptions. Example: "payments,customers".Your Dodo Payments API key. Should start with
dp_live_ for live mode or dp_test_ for test mode.Environment target. Must be either
"live_mode" or "test_mode". This determines which Dodo Payments environment to sync from.Using in Your Code
For programmatic control, integrate the sync feature directly into your application. Install it as a dependency in your project:Automatic Sync (Interval-based)
Use automatic sync when you want the sync to run continuously at regular intervals:Manual Sync
Use manual sync when you want to trigger sync operations on-demand (e.g., from a cron job or API endpoint):Constructor Options
Name of the database to use. Currently only
"mongodb" is supported.Connection string for your database. For MongoDB, provide a valid MongoDB connection URI.
Array of entities to sync. Available options:
"licences", "payments", "customers", "subscriptions". You can include any combination of these.Dodo Payments API configuration for authentication and environment selection. See the TypeScript SDK types for complete options.Required properties:
bearerToken: Your Dodo Payments API keyenvironment: Either"test_mode"or"live_mode"
Time in seconds between automatic syncs. Required when using
.start() for automatic syncing. Optional when using .run() for manual syncing.Important Information
The sync engine tracks changes and only syncs new or updated records, making subsequent syncs efficient even with large datasets.