Skip to main content

Checkout API Route

server route का उपयोग करके Dodo Payments checkout को अपने Nuxt app में integrate करें।

Customer Portal API Route

Nuxt server route के माध्यम से customers को subscriptions और details manage करने की सुविधा दें।

Webhooks API Route

Nuxt में Dodo Payments webhook events को securely receive और process करें।

अवलोकन

स्थापना

Installation

1

Install the Nuxt module

अपने project root में निम्न command चलाएँ:
2

Register the module in nuxt.config.ts

अपने modules array में @dodopayments/nuxt जोड़ें और इसे configure करें:
nuxt.config.ts
अपनी .env file या secrets को version control में कभी commit न करें।

API Route Handler के उदाहरण

Nuxt में सभी Dodo Payments integrations को server/routes/api/ directory में server routes के माध्यम से handle किया जाता है।
अपने Nuxt app में Dodo Payments checkout integrate करने के लिए इस handler का उपयोग करें। यह static (GET), dynamic (POST) और session (POST) payment flows को support करता है।
यदि productId missing या invalid है, तो handler 400 response लौटाता है।

Checkout Route Handler

Dodo Payments payments को अपनी website में integrate करने के लिए तीन प्रकार के payment flows support करता है; यह adaptor सभी प्रकार के payment flows को support करता है।
  • Static Payment Links: quick, no-code payment collection के लिए तुरंत share किए जा सकने वाले URLs।
  • Dynamic Payment Links: API या SDKs का उपयोग करके custom details के साथ programmatically payment links generate करें।
  • Checkout Sessions: pre-configured product carts और customer details के साथ secure, customizable checkout experiences बनाएँ।

समर्थित Query Parameters

string
आवश्यक
Product identifier (e.g., ?productId=pdt_nZuwz45WAs64n3l07zpQR).
integer
Product की मात्रा।
string
Customer का पूरा नाम।
string
Customer का पहला नाम।
string
Customer का अंतिम नाम।
string
Customer का email address।
string
Customer का देश।
string
Customer का address line।
string
Customer का शहर।
string
Customer का राज्य/प्रांत।
string
Customer का zip/postal code।
boolean
पूरा नाम field को disable करें।
boolean
पहला नाम field को disable करें।
boolean
अंतिम नाम field को disable करें।
boolean
email field को disable करें।
boolean
देश field को disable करें।
boolean
address line field को disable करें।
boolean
शहर field को disable करें।
boolean
राज्य field को disable करें।
boolean
zip code field को disable करें।
string
Payment currency निर्दिष्ट करें (e.g., USD)।
boolean
Currency selector दिखाएँ।
number
चार्ज की जाने वाली राशि को major currency units में निश्चित करता है (e.g., $12.50 के लिए 12.5)। केवल Pay What You Want products के लिए, और यदि यह product की minimum price से कम हो तो इसे अनदेखा कर दिया जाता है।
boolean
Discount fields दिखाएँ।
string
metadata_ से शुरू होने वाला कोई भी query parameter metadata के रूप में पास किया जाएगा।
यदि productId missing है, तो handler 400 response लौटाता है। Invalid query parameters के परिणामस्वरूप भी 400 response मिलता है।

Response Format

Static checkout checkout URL के साथ JSON response लौटाता है:
Dynamic Checkout अप्रचलित POST /payments और POST /subscriptions endpoints के लिए proxy का काम करता है। यह मौजूदा integrations के लिए काम करता रहता है, लेकिन नए integrations को नीचे दिए गए Checkout Sessions का उपयोग करना चाहिए।

Response Format

Dynamic checkout checkout URL के साथ JSON response लौटाता है:
Checkout sessions एक अधिक सुरक्षित, hosted checkout experience प्रदान करते हैं, जो पूर्ण customization control के साथ one-time purchases और subscriptions दोनों के लिए complete payment flow को संभालता है।अधिक जानकारी और supported fields की पूरी सूची के लिए Checkout Sessions Integration Guide देखें।

Response Format

Checkout sessions checkout URL के साथ JSON response लौटाते हैं:

Customer Portal Route Handler

Customer Portal Route Handler आपको अपने Nuxt application में Dodo Payments customer portal को आसानी से integrate करने में सक्षम बनाता है।

Query Parameters

string
आवश्यक
portal session के लिए customer ID (उदाहरण के लिए, ?customer_id=cus_123)।
boolean
यदि इसे true पर सेट किया जाता है, तो customer को portal link वाला email भेजा जाता है।
यदि customer_id अनुपस्थित है, तो 400 लौटाता है।

Webhook Route Handler

  • Method: केवल POST requests supported हैं। अन्य methods 405 लौटाते हैं।
  • Signature Verification: webhookKey का उपयोग करके webhook signature verify करता है। Verification विफल होने पर 401 लौटाता है।
  • Payload Validation: Zod से validate किया जाता है। Invalid payloads के लिए 400 लौटाता है।
  • Error Handling:
    • 401: Invalid signature
    • 400: Invalid payload
    • 500: Verification के दौरान internal error
  • Event Routing: Payload type के आधार पर उपयुक्त event handler को call करता है।

Supported Webhook Event Handlers


Prompt for LLM

अंतिम संशोधन 21 अगस्त 2026