Skip to main content

Quick Start

Create your first checkout session in under 5 minutes

API Reference

Full API documentation and interactive testing

Preview Endpoint

Calculate pricing and taxes before creating a session
Session Validity: Checkout sessions expire after 24 hours by default, or 15 minutes when confirm: true.
Single-Use Links: The checkout_url is not reusable. Generate a fresh session for each customer and payment attempt rather than sharing or reusing a link.

Prerequisites

You need:
  • An active Dodo Payments merchant account
  • API credentials from Developer → API Keys in the dashboard
  • At least one product created in Products

Creating Your First Checkout Session

API Response

All methods return:
Only session_id is guaranteed to be present. When payment_method_id is provided, the charge processes immediately and checkout_url is null. Use the returned payment_id instead. When confirm: true, the payment is created at session-creation time, and the response also includes payment_id, client_secret, and publishable_key for use with the Dodo Payments checkout SDK.

Redirect Your Customer

1

Extract the checkout URL

Get checkout_url from the API response.
2

Redirect to checkout

Send your customer to the URL:
Alternatively, open in a new window:
3

Handle the return

After payment, customers are redirected to your return_url with query parameters:Example redirect:
Instead of redirecting, you can embed checkout directly in your page using Overlay Checkout (modal), Inline Checkout (embedded), or Mobile SDKs (native apps). All consume the same session URL.

सत्र की स्थिति जाँचें

सत्र की स्थिति जाँचने के लिए Get Checkout Session (GET /checkouts/{id}) को कॉल करें। प्रतिक्रिया में सत्र का id, created_at, customer_email और customer_name, साथ ही payment_id और payment_status शामिल होते हैं। ग्राहक द्वारा विवरण दर्ज किए जाने के दौरान दोनों payment fields null होते हैं। ग्राहक द्वारा payment सबमिट करने के बाद, payment_status payment की स्थिति रखता है, जैसे succeeded, failed या processing। Fulfillment के लिए webhooks को source of truth के रूप में उपयोग करें।

Request Body

Required Fields

array
आवश्यक
Checkout session में शामिल किए जाने वाले products की array। प्रत्येक product में आपके dashboard से प्राप्त मान्य product_id होना चाहिए।आप एक ही session में one-time payment products और subscription products को मिला सकते हैं।
अपने Product IDs खोजें: Product IDs अपने Dodo Payments dashboard में Products → View Details के अंतर्गत खोजें या List Products API का उपयोग करें।

Optional Fields

object
Customer की जानकारी। आप उनकी ID का उपयोग करके किसी मौजूदा customer को जोड़ सकते हैं या checkout के दौरान नया customer record बना सकते हैं।
object
सटीक tax calculation, fraud prevention और regulatory compliance के लिए billing address की जानकारी।जब confirm: true हो, तो billing address के सभी fields आवश्यक हो जाते हैं।
array
Checkout के दौरान customers के लिए उपलब्ध payment methods को नियंत्रित करें। इससे specific markets या business requirements के लिए optimization में मदद मिलती है।Common options: credit, debit, upi_collect, apple_pay, google_pay, amazon_pay, klarna, affirm, afterpay_clearpay, cashapp, ach, multibanco, bancontact_card, eps, ideal, blik, gcash, ali_pay_hk, fps, touch_n_go, paypalपूरी सूची के लिए Create Checkout Session API reference देखें।
जब पसंदीदा payment methods उपलब्ध न हों, तो checkout failures रोकने के लिए fallback options के रूप में हमेशा credit और debit शामिल करें।
Example:
string
Fixed billing currency के साथ default currency selection को override करें। ISO 4217 currency codes का उपयोग करता है।Supported Currencies: USD, EUR, GBP, CAD, AUD, INR और अन्यExample: US Dollars के लिए "USD", Euros के लिए "EUR"यह field केवल adaptive pricing सक्षम होने पर प्रभावी होती है। adaptive pricing अक्षम होने पर product की default currency का उपयोग किया जाता है।
boolean
डिफ़ॉल्ट:"false"
Returning customers के लिए पहले से saved payment methods दिखाएँ, जिससे checkout speed और user experience बेहतर होता है।
string
Payment पूरा होने के बाद customers को redirect करने के लिए URL। Redirect पर Dodo Payments आपके URL में query parameters जोड़ता है (ऊपर redirect table देखें)।Example redirect URLs:
अतिरिक्त API call की आवश्यकता के बिना, return page पर license keys दिखाने या तुरंत confirmation भेजने के लिए license_key और email query parameters का उपयोग करें।
string
जब customers back button पर क्लिक करें या checkout session cancel करें, तब उन्हें redirect करने के लिए URL। यदि यह प्रदान नहीं किया जाता है, तो back button दिखाई नहीं देगा।Customers को purchase पूरा किए बिना आपकी site पर लौटने का स्पष्ट तरीका देने के लिए एक cancel_url सेट करें।
boolean
डिफ़ॉल्ट:"false"
यदि true है, तो session के सभी details तुरंत finalize हो जाते हैं। Required data अनुपलब्ध होने पर API error throw करती है।जब confirm: true:
  • Billing address के सभी fields आवश्यक हो जाते हैं
  • Charge को तुरंत process करने के लिए payment_method_id प्रदान किया जा सकता है
  • Session 24 hours के बजाय 15 minutes बाद expire होता है
  • यदि payment_method_id प्रदान किया गया है, तो मौजूदा customer_id आवश्यक है
array
Checkout session पर एक या अधिक stacked discount codes लागू करें। Codes array order में लागू होते हैं (पहला code शुरुआती price को कम करता है, दूसरा पहले से discounted price को कम करता है और इसी प्रकार), तथा प्रत्येक session में अधिकतम 20 codes लागू किए जा सकते हैं।जब Purchasing Power Parity सक्षम हो, तो शुरुआती price base price नहीं, बल्कि PPP-adjusted amount होती है।
नीचे दिया गया singular discount_code field deprecated है, लेकिन अभी भी पूरी तरह supported है। इसे उसी request में discount_codes के साथ combine नहीं किया जा सकता।
string
अप्रचलित
Deprecated — नए integrations के लिए discount_codes को प्राथमिकता दें। Backward compatibility के लिए यह field अभी भी काम करती है, लेकिन इसे उसी request में discount_codes के साथ combine नहीं किया जा सकता।
object
Session के बारे में अतिरिक्त जानकारी store करने के लिए custom key-value pairs।
boolean
इस session के लिए merchant के default 3DS behaviour को override करें।
boolean
डिफ़ॉल्ट:"false"
Minimal address collection mode सक्षम करें। सक्षम होने पर checkout केवल ये fields collect करता है:
  • Country: Tax determination के लिए हमेशा आवश्यक
  • ZIP/Postal code: केवल उन regions में जहाँ sales tax, VAT या GST calculation के लिए आवश्यक हो
अनावश्यक form fields हटाकर यह checkout friction को काफी कम करता है।
string
Attached customer से संबंधित saved payment method। इसके लिए confirm: true और मौजूदा customer.customer_id आवश्यक हैं। Payment method को payment की currency के साथ eligibility के लिए validate किया जाता है। सेट किए जाने पर charge तुरंत process होता है और checkout_url को null के रूप में return किया जाता है। इसके बजाय लौटाए गए payment_id का उपयोग करें।
यदि true है, तो full session URL के बजाय shortened checkout URL return करता है।
string
Collection-based checkout flow के लिए product collection ID। इसे सेट करते समय एक empty product_cart array पास करें। Session creation पर discount codes pre-apply नहीं किए जा सकते। Product Collections देखें।
string
Customer के लिए Tax ID (उदाहरण के लिए VAT number)। इसके लिए billing_address और एक country आवश्यक है।
string
Tax ID से संबद्ध वैकल्पिक business या legal name, अधिकतम 250 characters। मान्य tax_id के साथ प्रदान किए जाने पर invoice में customer के personal name के बजाय इसे दिखाया जाता है।
integer
Indian cards पर INR e-mandates के लिए merchant-level mandate floor (INR paise में) को override करें।Processor को भेजी जाने वाली mandate amount max(this_floor, actual_billing_amount) है, इसलिए billing कम होने पर यह प्रभावी रूप से customer-facing authorization ceiling होती है। सेट न होने पर merchant setting लागू होती है; वह भी सेट न होने पर system default ₹15,000 लागू होता है।
object
Checkout interface के appearance और behaviour को customize करें।
object
Checkout session के लिए specific features और behaviours configure करें।
array
Custom form fields के साथ checkout के दौरान customers से अतिरिक्त जानकारी collect करें। आप प्रत्येक checkout session में अधिकतम 5 custom fields define कर सकते हैं। Customer responses webhook payloads में शामिल होते हैं और API के माध्यम से उपलब्ध रहते हैं।
Custom fields के लिए customer responses इनमें शामिल होते हैं:
  • Webhooks: payment.succeeded, subscription.active और अन्य relevant event payloads में custom_field_responses array शामिल होती है
  • API responses: Payment और subscription objects में custom_field_responses शामिल होता है
object
Subscription products वाले checkout sessions के लिए अतिरिक्त configuration।

Usage Examples

Simple Single Product Checkout

Multi-Product Cart

Subscription with Trial Period

Pre-Confirmed Checkout

Checkout with Currency Override

Saved Payment Methods for Returning Customers

B2B Checkout with Tax ID Collection

Dark Theme Checkout with Stacked Discount Codes

Regional Payment Methods (UPI for India)

UPI configuration और testing की विस्तृत जानकारी के लिए India Payment Methods page देखें।

BNPL (Buy Now Pay Later) Checkout

BNPL configuration और testing की विस्तृत जानकारी के लिए Buy Now Pay Later (BNPL) page देखें।

Instant Checkout with Existing Payment Method

Skip Payment Success Page with Immediate Redirect

Forcing a Language

Collecting Custom Fields

Previewing Checkout Sessions

Session बनाने से पहले pricing, taxes और totals calculate करने के लिए Preview Checkout Session endpoint का उपयोग करें। आपकी site पर accurate pricing information दिखाने के लिए यह उपयोगी है।
Preview किया गया current_breakup.subtotal पहले से Purchasing Power Parity और Charm Pricing को दर्शाता है, जहाँ वे product पर लागू होते हैं।
जब cart में subscription product होता है, तो preview response एक next_billing_date भी return करता है — आगामी billing date का preview, ताकि subscription बनाए जाने से पहले आप इसे दिखा सकें। इसकी गणना वर्तमान समय के सापेक्ष की जाती है: trial लागू होने पर now + trial period, अन्यथा now + one payment frequency। केवल one-time carts के लिए यह field omitted होती है। यह preview time पर आधारित estimate है; authoritative next_billing_date subscription activate होने पर set किया जाता है।
Preview trial_period_days (effective trial length, free या paid) और trial_amount (discounts के बाद per-unit trial charge, price currency की minor units में) भी return करता है। trial_amount केवल paid trial के लिए मौजूद होता है और free trial या no trial के लिए null होता है। आज वास्तव में देय taxed total के लिए current_breakup का उपयोग करें।
यदि आप Dynamic Links का उपयोग कर रहे हैं, तो Checkout Sessions अधिक flexibility प्रदान करते हैं। Dynamic Links के साथ आपको customer का पूरा billing address देना पड़ता था। Checkout Sessions के साथ आप उपलब्ध जानकारी भेज सकते हैं और checkout flow बाकी जानकारी collect करता है। उदाहरण के लिए:
  • केवल customer का billing country दें और checkout बाकी details collect कर लेता है।
  • या सभी information दें और सीधे payment page पर जाने के लिए confirm: true सेट करें।
Migration straightforward है: अपने integration को Checkout Sessions API या SDK method का उपयोग करने के लिए update करें, request payload को Checkout Sessions format के अनुसार adjust करें और आपका काम पूरा हो जाता है। किसी additional handling की आवश्यकता नहीं है।

Overlay Checkout

अपने page पर checkout को modal overlay के रूप में खोलें

Inline Checkout

Checkout को सीधे अपने page में embed करें

Mobile Integration

Native mobile apps में checkout integrate करें

Webhooks

Payment और subscription events के लिए listen करें

Payment Methods

Region के अनुसार supported payment methods

Subscriptions

Recurring billing और subscription management
अंतिम संशोधन 26 सितंबर 2026