Skip to main content

Checkout Handler

अपने Astro app में Dodo Payments checkout integrate करें।

Customer Portal

ग्राहकों को subscriptions और विवरण manage करने दें।

Webhooks

Dodo Payments webhook events प्राप्त और process करें।

Installation

1

Install the package

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

Set up environment variables

अपने project root में .env file बनाएँ:
अपनी .env file या secrets को version control में कभी commit न करें।

Route Handler Examples

सभी examples में यह माना गया है कि आप Astro App Router का उपयोग कर रहे हैं।
अपने Astro app में Dodo Payments checkout integrate करने के लिए इस handler का उपयोग करें। यह static (GET), dynamic (POST) और session (POST) payment flows को support करता है।

Checkout Route Handler

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

Supported Query Parameters

string
आवश्यक
Product identifier (उदाहरण के लिए, ?productId=pdt_nZuwz45WAs64n3l07zpQR)।
integer
Product की quantity।
string
Customer का पूरा नाम।
string
Customer का पहला नाम।
string
Customer का अंतिम नाम।
string
Customer का email address।
string
Customer का देश।
string
Customer का address line।
string
Customer का शहर।
string
Customer का state/province।
string
Customer का zip/postal code।
boolean
Full name field disable करें।
boolean
First name field disable करें।
boolean
Last name field disable करें।
boolean
Email field disable करें।
boolean
Country field disable करें।
boolean
Address line field disable करें।
boolean
City field disable करें।
boolean
State field disable करें।
boolean
Zip code field disable करें।
string
Payment currency निर्दिष्ट करें (उदाहरण के लिए, USD)।
boolean
Currency selector दिखाएँ।
integer
Payment amount निर्दिष्ट करें (उदाहरण के लिए, $10.00 के लिए 1000)।
boolean
Discount fields दिखाएँ।
string
metadata_ से शुरू होने वाला कोई भी query parameter metadata के रूप में pass किया जाएगा।
यदि productId मौजूद नहीं है, तो handler 400 response लौटाता है। Invalid query parameters के परिणामस्वरूप भी 400 response मिलता है।

Response Format

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

Response Format

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

Response Format

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

Customer Portal Route Handler

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

Query Parameters

string
आवश्यक
Portal session के लिए customer ID (उदाहरण के लिए, ?customer_id=cus_123)।
boolean
यदि इसे true पर set किया जाता है, तो 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

अंतिम संशोधन 31 जुलाई 2026