Skip to main content

Quick Start Guide

Get your first checkout session running in under 5 minutes

API Reference & Live Testing

Explore the full API documentation and interactively test Checkout Session requests and responses.

Preview Checkout

Calculate pricing, taxes, and totals before creating a session.
Session Validity: Checkout sessions are valid for 24 hours by default. If you pass confirm=true in your request, the session will only be valid for 15 minutes.
Single-Use Links: The checkout_url returned by the API is not reusable and expires within 24 hours (or 15 minutes when confirm=true). It is intended for a single customer to complete one payment. Generate a fresh checkout session for each customer and each payment attempt rather than sharing or reusing a link.

Prerequisites

1

Dodo Payments Account

You’ll need an active Dodo Payments merchant account with API access.
2

API Credentials

Generate your API credentials from the Dodo Payments dashboard:
3

Products Setup

Create your products in the Dodo Payments dashboard before implementing checkout sessions.

Creating Your First Checkout Session

API Response

All methods above return the same response structure:
Only session_id is guaranteed to be present. Two cases return additional or fewer fields:
  • payment_method_id was provided — the charge is processed immediately and checkout_url is null. Use the returned payment_id instead.
  • confirm: true created the payment at session-creation time — the response also includes payment_id, client_secret, and publishable_key for use with the Dodo Payments checkout SDK.
The generated checkout_url is single-use and expires within 24 hours. Don’t cache or reuse it across customers or payment attempts — create a new checkout session whenever you need a fresh link.
1

Get the checkout URL

Extract the checkout_url from the API response.
2

Redirect your customer

Direct your customer to the checkout URL to complete their purchase.
Alternative Integration Options: Instead of redirecting, you can embed the checkout directly in your page using Overlay Checkout (modal overlay) or Inline Checkout (fully embedded). In a native mobile app, hand the same URL to the Mobile Checkout SDKs for Android, iOS, React Native, or Flutter. All of these consume the same checkout session URL.
3

Handle the return

After payment, customers are redirected to your return_url with query parameters including payment/subscription ID, status, customer email, and any license keys. See the return_url parameter docs for the full list.

Request Body

Required Fields

Essential fields needed for every checkout session

Optional Fields

Additional configuration to customize your checkout experience

Required Fields

array
आवश्यक
Array of products to include in the checkout session. Each product must have a valid product_id from your Dodo Payments dashboard.
Mixed Checkout: You can combine one-time payment products and subscription products in the same checkout session. This enables powerful use cases like setup fees with subscriptions, hardware bundles with SaaS, and more.
Find Your Product IDs: You can find product IDs in your Dodo Payments dashboard under Products → View Details, or by using the List Products API.

Optional Fields

Configure these fields to customize the checkout experience and add business logic to your payment flow.
object
Customer information. You can either attach an existing customer using their ID or create a new customer record during checkout.
Attach an existing customer to the checkout session using their ID.
object
Billing address information for accurate tax calculation, fraud prevention, and regulatory compliance.
When confirm is set to true, all billing address fields become required for successful session creation.
array
Control which payment methods are available to customers during checkout. This helps optimize for specific markets or business requirements.सामान्य विकल्प: credit, debit, upi_collect, apple_pay, google_pay, amazon_pay, klarna, affirm, afterpay_clearpay, cashapp, ach, multibanco, bancontact_card, eps, ideal, blik, paypal। यह पूरी सूची नहीं है — सभी स्वीकृत मानों के लिए Create Checkout Session API reference देखें।
Critical: Always include credit and debit as fallback options to prevent checkout failures when preferred payment methods are unavailable.
Example:
string
Override the default currency selection with a fixed billing currency. Uses ISO 4217 currency codes.Supported Currencies: USD, EUR, GBP, CAD, AUD, INR, and moreExample: "USD" for US Dollars, "EUR" for Euros
This field is only effective when adaptive pricing is enabled. If adaptive pricing is disabled, the product’s default currency will be used.
boolean
डिफ़ॉल्ट:"false"
Display previously saved payment methods for returning customers, improving checkout speed and user experience.
string
URL to redirect customers after payment completion. Dodo Payments appends the following query parameters to your URL on redirect:Example redirect URLs:
Use the license_key and email query parameters to display license keys or send a confirmation immediately on your return page, without needing an extra API call.
string
URL to redirect customers when they click the back button or cancel the checkout session. If not provided, the back button will not be displayed.
Set a cancel_url to give customers a clear way to return to your site without completing the purchase. This improves the checkout experience and reduces friction.
boolean
डिफ़ॉल्ट:"false"
If true, finalizes all session details immediately. API will throw an error if required data is missing.
array
Checkout session में एक या अधिक stacked discount codes लागू करें। Codes को array order में लागू किया जाता है (पहला code शुरुआती कीमत को कम करता है, दूसरा पहले से discounted कीमत को कम करता है, और इसी प्रकार आगे), और प्रति session अधिकतम 20 codes लागू किए जा सकते हैं। जब Purchasing Power Parity सक्षम हो, तो शुरुआती कीमत base price नहीं, बल्कि PPP-adjusted amount होती है।
The singular discount_code field below is deprecated but still fully supported — existing integrations continue to work without changes. It cannot be combined with discount_codes in the same request. Migrate to discount_codes when convenient to take advantage of stacking.
string
अप्रचलित
Deprecated — prefer discount_codes for new integrations. This field still works for backward compatibility, but cannot be combined with discount_codes in the same request.
object
Custom key-value pairs to store additional information about the session.
boolean
Override merchant default 3DS behaviour for this session.
boolean
डिफ़ॉल्ट:"false"
Enable minimal address collection mode. When enabled, the checkout only collects:
  • Country: Always required for tax determination
  • ZIP/Postal code: Only in regions where it’s necessary for sales tax, VAT, or GST calculation
This significantly reduces checkout friction by eliminating unnecessary form fields.
Enable minimal address for faster checkout completion. Full address collection remains available for businesses that require complete billing details.
string
A saved payment method belonging to the attached customer. Requires confirm: true and an existing customer.customer_id. When set, the charge is processed immediately and checkout_url is returned as null — use the returned payment_id instead.
If true, returns a shortened checkout URL instead of the full session URL.
string
Product collection ID for the collection-based checkout flow.
string
Tax ID for the customer (for example, a VAT number). Requires billing_address with a country.
string
Optional business or legal name associated with the tax ID. When provided together with a valid tax_id, it is rendered on the invoice instead of the customer’s personal name.
integer
Override the merchant-level mandate floor (in INR paise) for INR e-mandates on Indian cards.
object
Customize the appearance and behavior of the checkout interface.
object
Configure specific features and behaviors for the checkout session.
array
Collect additional information from customers during checkout with custom form fields. You can define up to 5 custom fields per checkout session. Customer responses are included in webhook payloads and available via the API.
Customer responses to custom fields are included in:
  • Webhooks: payment.succeeded, subscription.active, and other relevant event payloads contain the custom_field_responses array
  • API responses: Payment and subscription objects include custom_field_responses
object
Additional configuration for checkout sessions containing subscription products.

Usage Examples

Here are 10 comprehensive examples showcasing different checkout session configurations for various business scenarios:

1. Simple Single Product Checkout

2. Multi-Product Cart

3. Subscription with Trial Period

4. Pre-confirmed Checkout

When confirm is set to true, the customer will be taken directly to the checkout page, bypassing any confirmation steps.

5. Checkout with Currency Override

The billing_currency override only takes effect when adaptive currency is enabled in your account settings. If adaptive currency is disabled, this parameter will have no effect.

6. Saved Payment Methods for Returning Customers

7. B2B Checkout with Tax ID Collection

8. Dark Theme Checkout with Stacked Discount Codes

9. Regional Payment Methods (UPI for India)

For detailed information about UPI configuration and testing, see the India Payment Methods page.

10. BNPL (Buy Now Pay Later) Checkout

For detailed information about BNPL configuration and testing, see the Buy Now Pay Later (BNPL) page.

11. Using Existing Payment Methods for Instant Checkout

Use a customer’s saved payment method to create a checkout session that processes immediately, skipping payment method collection:
When using payment_method_id, confirm must be set to true and an existing customer_id must be provided. The payment method will be validated for eligibility with the payment’s currency. Because the charge is processed immediately, checkout_url is returned as null — use the returned payment_id instead.
The payment method must belong to the customer and be compatible with the payment currency. This enables one-click purchases for returning customers.
Generate shortened, shareable payment links with custom slugs:
Short links are perfect for SMS, email, or social media sharing. They’re easier to remember and build more customer trust than long URLs.

13. Skip Payment Success Page with Immediate Redirect

Redirect customers immediately after payment completion, bypassing the default success page:
Use redirect_immediately: true when you have a custom success page that provides better user experience than the default payment success page. This is especially useful for mobile apps and embedded checkout flows.
When redirect_immediately is enabled, customers are redirected to your return_url immediately after payment completion, skipping the default success page entirely.

14. Forcing a Language

Force the checkout to display in a specific language, overriding the customer’s browser language detection:
Use force_language when you know your customer’s preferred language (e.g., from their account settings) or when targeting specific regional markets.
Supported languages: Arabic (ar), Catalan (ca), Chinese (zh), Dutch (nl), English (en), French (fr), German (de), Hebrew (he), Indonesian (id), Italian (it), Japanese (ja), Korean (ko), Malay (ms), Polish (pl), Portuguese (pt), Romanian (ro), Russian (ru), Spanish (es), Swedish (sv), Thai (th), Turkish (tr)

15. Collecting Custom Fields

Collect additional information from customers during checkout using custom fields:
Custom field responses are automatically included in webhook payloads (payment.succeeded, subscription.active, etc.) and can be retrieved via the API. Use them to enrich your CRM, trigger onboarding flows, or customize the customer experience.
Available field types: text, number, email, url, date, dropdown, boolean

Previewing Checkout Sessions

Before creating a checkout session, you can preview the pricing breakdown including taxes, discounts, and totals. This is useful for displaying accurate pricing to customers before they proceed to checkout.
Preview किया गया current_breakup.subtotal पहले से ही product पर लागू होने वाले Purchasing Power Parity और Charm Pricing को दर्शाता है।
जब cart में subscription product होता है, तो preview response एक next_billing_date भी लौटाता है — यह आगामी billing date का preview होता है, ताकि subscription बनने से पहले आप इसे दिखा सकें। इसकी गणना वर्तमान समय के सापेक्ष की जाती है: trial लागू होने पर now + trial period, अन्यथा now + one payment frequency। केवल one-time वाले carts के लिए यह field शामिल नहीं की जाती। यह preview समय पर आधारित एक अनुमान है; authoritative next_billing_date subscription सक्रिय होने पर सेट किया जाता है।
Preview trial_period_days (प्रभावी trial अवधि, चाहे free हो या paid) और trial_amount (discounts के बाद प्रति unit trial charge, price currency की minor units में) भी लौटाता है। trial_amount केवल paid trial के लिए मौजूद होता है और free trial या किसी trial के न होने पर null होता है। आज वास्तव में देय taxed total के लिए current_breakup का उपयोग करें।

Preview API Reference

पूरा preview endpoint documentation देखें।

मुख्य अंतर

पहले, Dynamic Links का उपयोग करके payment link बनाते समय, आपको customer का पूरा billing address देना आवश्यक था। Checkout Sessions के साथ अब यह आवश्यक नहीं है। आपके पास जो भी जानकारी हो, आप उसे भेज सकते हैं और बाकी काम हम संभाल लेंगे। उदाहरण के लिए:
  • यदि आपको customer का केवल billing country पता है, तो बस वही दें।
  • checkout flow customer को payment page पर ले जाने से पहले missing details अपने-आप एकत्र करेगा।
  • दूसरी ओर, यदि आपके पास पहले से सभी आवश्यक जानकारी है और आप सीधे payment page पर जाना चाहते हैं, तो आप पूरा data set भेज सकते हैं और अपने request body में confirm=true शामिल कर सकते हैं।

Migration Process

Dynamic Links से Checkout Sessions पर migrate करना सीधा है:
1

Update your integration

अपने integration को नई API या SDK method का उपयोग करने के लिए update करें।
2

Adjust request payload

Checkout Sessions format के अनुसार request payload को समायोजित करें।
3

That's it!

हाँ। आपकी ओर से किसी अतिरिक्त handling या विशेष migration steps की आवश्यकता नहीं है।

संबंधित API Reference

Create Checkout Session

सभी उपलब्ध parameters और options के साथ checkout sessions बनाने के लिए Complete API reference

Preview Checkout Session

session बनाने से पहले pricing, taxes और totals का preview देखने के लिए API reference
अंतिम संशोधन 26 अगस्त 2026