Skip to main content
Billing SDK React billing components का एक open-source सेट है, जिसमें एक CLI शामिल है जो आपके प्रोजेक्ट को Dodo Payments से कनेक्ट करता है। CLI आपके framework के लिए API routes, React hook और Dodo Payments client जनरेट करता है, और pricing tables तथा usage meters जैसे components जोड़ता है।

अवलोकन

Billing SDK में शामिल हैं:
  • React Components: React applications के लिए पहले से बने, अनुकूलन योग्य billing components।
  • CLI Tooling: एक command-line interface जो projects को initialize करता है और components जोड़ता है।
  • Framework Support: Next.js, Express.js, Hono, Fastify, NestJS और React के लिए templates।
  • Payment Provider: Dodo Payments के साथ पूर्ण integration।

त्वरित प्रारंभ

किसी मौजूदा project में Billing SDK सेट अप करने के लिए, project root से CLI चलाएँ:
1

Install the CLI

इसे install किए बिना npx के साथ CLI चलाएँ:
या बार-बार उपयोग के लिए इसे globally install करें। Global install से billingsdk command जुड़ती है, उदाहरण के लिए billingsdk init:
2

Initialize a Project

अपने project में billing जोड़ने के लिए interactive setup चलाएँ:
CLI आपको इन विकल्पों को चुनने के लिए कहता है:
  • आपका framework: Next.js, Express.js, React, Hono, Fastify या NestJS। CLI आपके framework का पता लगाता है और उसे detected के रूप में चिह्नित करता है।
  • आपका payment provider: Dodo Payments चुनें।
3

Add Components

अपने प्रोजेक्ट में व्यक्तिगत बिलिंग कंपोनेंट्स जोड़ें:

समर्थित ढांचे

Billing SDK में इनमें से प्रत्येक framework के लिए Dodo Payments template है:

CLI कमांड

@billingsdk/cli init

init आपके project में billing सेट अप करता है: यह Dodo Payments integration वाले framework template और template के लिए आवश्यक dependencies install करता है। यह क्या करता है:
  1. Framework Selection: आप अपना framework और payment provider चुनते हैं।
  2. Template Installation: CLI Billing SDK registry से आपके framework और provider का template download करता है और उसकी files install करता है।
  3. Dependency Management: CLI template की dependencies, जैसे dodopayments, standardwebhooks और zod, npm, pnpm, Yarn या Bun के साथ install करता है।
  4. File Generation: CLI configuration files और boilerplate code लिखता है। Express.js, Fastify, Hono और NestJS के लिए यह उन्हें src/ के अंतर्गत लिखता है।
उदाहरण:
बिना prompts के init चलाने के लिए --framework, --provider और --yes पास करें, उदाहरण के लिए npx @billingsdk/cli init --framework nextjs --provider dodopayments --yes। Files को लिखे बिना उनकी सूची देखने के लिए --dry-run जोड़ें, dependency install छोड़ने के लिए --no-install, या npm, pnpm, yarn या bun चुनने के लिए --package-manager जोड़ें।

@billingsdk/cli add

add shadcn/ui registry system के ज़रिए आपके project में एक billing component install करता है। यह आपके package manager के runner के साथ shadcn@latest add @billingsdk/<component> चलाता है। उदाहरण:
क्या होता है:
  1. shadcn CLI registry से component configuration download करता है।
  2. यह component files को आपकी components/billingsdk/ directory में install करता है।
  3. आवश्यकता होने पर यह आपके project configuration को update करता है।
  4. यह कोई भी अतिरिक्त dependencies install करता है।

Generated Files Structure

init चलाने के बाद आपके project में ये शामिल होते हैं:
  • API Routes: checkout, customers, customer payments, products, subscriptions और webhooks के लिए endpoints। React template में कोई API routes नहीं होते।
  • Hooks: React और Next.js के लिए billing operations हेतु एक useBilling React hook।
  • Library Files: Dodo Payments client setup और helper functions, lib/dodopayments.ts में।
  • Environment Configuration: एक example environment file, .env.example।

Next.js Example Structure

Next.js के लिए init ये files लिखता है:

Environment Configuration

Initialization के बाद अपने environment variables सेट करें। Dashboard में Developer → API Keys से API key और Developer → Webhooks से webhook key प्राप्त करें:
DODO_PAYMENTS_ENVIRONMENT को test_mode या live_mode पर सेट करें। Generated Dodo Payments client किसी अन्य value के लिए error throw करता है।
अपनी API keys को environment variables में रखें। उन्हें version control में कभी commit न करें।

Available Components

Billing SDK इन groups में React components उपलब्ध कराता है:
  • Pricing Tables: product pricing दिखाने के लिए आठ variants, pricing-table-one से pricing-table-eight तक।
  • Subscription Management: subscription-management, साथ ही subscription cancel करने या plan update करने के लिए cards और dialogs।
  • Usage Monitoring: usage-based billing के लिए circular और linear usage meters तथा usage tables।
  • Checkout Components: payment method selector, payment details forms और payment failure card।
  • Customer Portal: customer self-service के लिए billing settings, billing screen, invoice history और upcoming charges।
हर component को live preview के साथ देखने के लिए component library देखें।

Open Source

Billing SDK open source है:
  • Transparency: आप देख सकते हैं कि हर component कैसे काम करता है।
  • Community: Developers इसे अन्य developers के लिए बनाते हैं।
  • Security: Security issues के लिए कोई भी code की समीक्षा कर सकता है।
  • Innovation: Community contributions development को तेज़ करती हैं।
Billing SDK GNU General Public License v3.0 (GPL-3.0) के अंतर्गत जारी किया गया है, जो project को open और free बनाए रखता है।

Getting Help

Billing SDK के लिए सहायता पाने हेतु इन resources का उपयोग करें:

Contributing

Billing SDK contributions का स्वागत करता है। contribution guide बताती है कि कैसे:
  • Bugs report करें
  • Features request करें
  • Pull requests submit करें
  • नए components जोड़ें
  • Documentation बेहतर बनाएँ

Learn More

Full Documentation

उदाहरणों और best practices के साथ Billing SDK की complete guide

CLI Reference

सभी commands और options के लिए विस्तृत CLI documentation

Component Library

live examples के साथ सभी उपलब्ध components देखें
अंतिम संशोधन 26 सितंबर 2026