Installation
Install the SDK using your package manager of choice:Quick Start
Initialize the client with your API key and start processing payments:Core Features
TypeScript First
Full TypeScript support with comprehensive type definitions for all API endpoints
Auto-Pagination
Automatic pagination for list responses makes working with large datasets effortless
Error Handling
Built-in error types with detailed messages for different failure scenarios
Smart Retries
Configurable automatic retries with exponential backoff for transient errors
Configuration
Environment Variables
Set environment variables for secure configuration:.env
Timeout Configuration
Configure request timeouts globally or per-request:Retry Configuration
Configure automatic retry behavior:Common Operations
Create a Checkout Session
Generate a checkout session for collecting payment information:Manage Customers
Create and retrieve customer information:Handle Subscriptions
Create and manage recurring subscriptions:billingには、少なくとも2文字のISO国コードが必要です。customerは、既存の顧客を紐付ける{ customer_id }、または新しい顧客を作成する{ email, name? }のいずれかです。product_priceは、通貨の最小単位で指定します。使用量ベースのBilling
使用量イベントの取り込み
使用量ベースのBilling用にカスタムイベントを追跡します:イベントには、冪等性を確保するために一意の
event_id値を設定する必要があります。同一リクエスト内で重複するIDは拒否され、既存のIDを含む後続のリクエストは無視されます。使用量イベントの取得
使用量イベントの詳細情報を取得します:Proxyの設定
さまざまなランタイム向けにProxy設定を構成します:Node.js(undiciを使用)
Bun
Deno
ロギング
環境変数またはクライアントオプションを使用して、ログの詳細度を制御します:'debug'- デバッグメッセージ、情報、警告、エラーを表示'info'- 情報、警告、エラーを表示'warn'- 警告とエラーを表示(デフォルト)'error'- エラーのみを表示'off'- すべてのロギングを無効化
Node.js SDKからの移行
従来のNode.js SDKからアップグレードする場合、TypeScript SDKでは型安全性と機能が向上しています:View Migration Guide
Node.js SDKからTypeScript SDKへの移行方法
自動ページネーション
DodoPayments APIのListメソッドはページネーションに対応しています。for await … of構文を使用すると、すべてのページにわたって項目を反復処理できます:
要件
以下のランタイムがサポートされています:- Webブラウザー(最新のChrome、Firefox、Safari、Edgeなど)
- Node.js 20 LTS以降の(non-EOL)バージョン
- Deno v1.28.0以降
- Bun 1.0以降
- Cloudflare Workers
- Vercel Edge Runtime
"node"環境でのJest 28以降- Nitro v2.6以降
リソース
GitHub Repository
ソースコードを確認して貢献する
API Reference
APIドキュメントをすべて確認する
Discord Community
ヘルプを受け、開発者とつながる
Report Issues
バグを報告する、または機能をリクエストする
サポート
TypeScript SDKについてサポートが必要ですか?- Discord:コミュニティサーバーに参加して、リアルタイムのサポートを受けてください
- Email:support@dodopayments.com
- GitHub:リポジトリでissueを開いてください