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 は最小の通貨単位で表されます。使用量に基づく請求
使用イベントの取り込み
使用量に基づく請求のためのカスタムイベントを追跡します:イベントには一意の
event_id 値が必要で、冪等性を確保します。同じリクエスト内の重複したIDは拒否され、既存のIDを持つ後続のリクエストは無視されます。使用イベントの取得
使用イベントに関する詳細情報を取得します:プロキシ設定
異なるランタイムのプロキシ設定を構成します: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のリストメソッドはページネーションされています。すべてのページにわたってアイテムを繰り返し処理するには、for await … of 構文を使用できます:
必要条件
次のランタイムがサポートされています:- Webブラウザ(最新のChrome、Firefox、Safari、Edgeなど)
- Node.js 20 LTS以降の(非EOL)バージョン
- Deno v1.28.0以降
- Bun 1.0以降
- Cloudflare Workers
- Vercel Edge Runtime
- Jest 28以上で
"node"環境 - Nitro v2.6以上
リソース
GitHub Repository
ソースコードを表示し、貢献する
API Reference
完全なAPIドキュメント
Discord Community
ヘルプを取得し、開発者とつながる
Report Issues
バグを報告するか、機能をリクエストする
サポート
TypeScript SDKに関するヘルプが必要ですか?- Discord: コミュニティサーバーに参加してリアルタイムのサポートを受ける
- Email: support@dodopayments.com に連絡してください
- GitHub: リポジトリで問題を開く