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.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
- Node.js SDK
- Python SDK
- REST API
API Response
All methods above return the same response structure:session_id is guaranteed to be present. Two cases return additional or fewer fields:
payment_method_idwas provided — the charge is processed immediately andcheckout_urlisnull. Use the returnedpayment_idinstead.confirm: truecreated the payment at session-creation time — the response also includespayment_id,client_secret, andpublishable_keyfor 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.
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
bắt buộc
Array of products to include in the checkout session. Each product must have a valid
product_id from your Dodo Payments dashboard.Optional Fields
Configure these fields to customize the checkout experience and add business logic to your payment flow.Customer Information
Customer Information
object
Customer information. You can either attach an existing customer using their ID or create a new customer record during checkout.
- Attach Existing Customer
- New Customer
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.Payment Configuration
Payment Configuration
array
Control which payment methods are available to customers during checkout. This helps optimize for specific markets or business requirements.Các tùy chọn phổ biến:
credit, debit, upi_collect, apple_pay, google_pay, amazon_pay, klarna, affirm, afterpay_clearpay, cashapp, ach, multibanco, bancontact_card, eps, ideal, blik, paypal. Đây không phải là toàn bộ tập giá trị — hãy xem tài liệu tham khảo API Create Checkout Session để biết mọi giá trị được chấp nhận.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 EurosThis field is only effective when adaptive pricing is enabled. If adaptive pricing is disabled, the product’s default currency will be used.
boolean
mặc định:"false"
Display previously saved payment methods for returning customers, improving checkout speed and user experience.
Session Management
Session Management
string
URL to redirect customers after payment completion. Dodo Payments appends the following query parameters to your URL on redirect:
Example redirect URLs:
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.
boolean
mặc định:"false"
If true, finalizes all session details immediately. API will throw an error if required data is missing.
array
Áp dụng một hoặc nhiều mã giảm giá xếp chồng cho phiên thanh toán. Các mã được áp dụng theo thứ tự trong mảng (mã đầu tiên giảm giá khởi điểm, mã thứ hai giảm giá đã được giảm, và tiếp tục như vậy), tối đa 20 mã cho mỗi phiên. Khi Purchasing Power Parity được bật, giá khởi điểm là số tiền đã điều chỉnh theo PPP, không phải giá cơ sở.
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
không còn sử dụng
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
mặc định:"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
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.boolean
mặc định:"false"
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.
UI Customization & Features
UI Customization & Features
Custom Fields
Custom Fields
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 thecustom_field_responsesarray - API responses: Payment and subscription objects include
custom_field_responses
Subscription Configuration
Subscription Configuration
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:The payment method must belong to the customer and be compatible with the payment currency. This enables one-click purchases for returning customers.
12. Short Links for Cleaner Payment URLs
Generate shortened, shareable payment links with custom slugs:13. Skip Payment Success Page with Immediate Redirect
Redirect customers immediately after payment completion, bypassing the default success page: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: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.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.Giá trị
current_breakup.subtotal trong bản xem trước đã phản ánh Purchasing Power Parity và Charm Pricing khi các tính năng này áp dụng cho sản phẩm.Khi giỏ hàng chứa sản phẩm đăng ký, phản hồi xem trước cũng trả về
next_billing_date — bản xem trước của ngày thanh toán sắp tới, để bạn có thể hiển thị ngày này trước khi đăng ký được tạo. Giá trị được tính tương đối với thời điểm hiện tại: now + trial period khi áp dụng thời gian dùng thử, nếu không thì là now + one payment frequency. Trường này bị bỏ qua đối với giỏ hàng chỉ chứa sản phẩm mua một lần. Đây là ước tính dựa trên thời điểm xem trước; next_billing_date chính thức được thiết lập khi đăng ký được kích hoạt.Bản xem trước cũng trả về
trial_period_days (thời lượng dùng thử thực tế, miễn phí hoặc có tính phí) và trial_amount (phí dùng thử trên mỗi đơn vị sau khi giảm giá, tính theo đơn vị nhỏ nhất của loại tiền tệ dùng cho giá). trial_amount chỉ xuất hiện với paid trial và có giá trị null đối với thời gian dùng thử miễn phí hoặc không có thời gian dùng thử. Sử dụng current_breakup cho tổng tiền đã bao gồm thuế thực sự đến hạn thanh toán hôm nay.- Node.js SDK
- Python SDK
Preview API Reference
Xem tài liệu đầy đủ về endpoint xem trước.
Chuyển từ Dynamic Links sang Checkout Sessions
Những khác biệt chính
Trước đây, khi tạo liên kết thanh toán bằng Dynamic Links, bạn bắt buộc phải cung cấp địa chỉ thanh toán đầy đủ của khách hàng. Với Checkout Sessions, điều này không còn cần thiết. Bạn chỉ cần truyền bất kỳ thông tin nào mình có, phần còn lại chúng tôi sẽ xử lý. Ví dụ:- Nếu bạn chỉ biết quốc gia thanh toán của khách hàng, chỉ cần cung cấp thông tin đó.
- Luồng thanh toán sẽ tự động thu thập các thông tin còn thiếu trước khi chuyển khách hàng đến trang thanh toán.
- Ngược lại, nếu bạn đã có tất cả thông tin bắt buộc và muốn chuyển thẳng đến trang thanh toán, bạn có thể truyền toàn bộ tập dữ liệu và thêm
confirm=truevào request body.
Quy trình di chuyển
Việc chuyển từ Dynamic Links sang Checkout Sessions rất đơn giản:1
Update your integration
Cập nhật tích hợp của bạn để sử dụng phương thức API hoặc SDK mới.
2
Adjust request payload
Điều chỉnh payload của request theo định dạng Checkout Sessions.
3
That's it!
Có. Bạn không cần thực hiện thêm bất kỳ thao tác xử lý hoặc bước di chuyển đặc biệt nào.
Tài liệu tham khảo API liên quan
Create Checkout Session
Tài liệu tham khảo API đầy đủ để tạo phiên thanh toán với tất cả tham số và tùy chọn hiện có
Preview Checkout Session
Tài liệu tham khảo API để xem trước giá, thuế và tổng tiền trước khi tạo phiên