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: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 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
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.
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
Control which payment methods are available to customers during checkout. This helps optimize for specific markets or business requirements.Available Options:
credit, debit, upi_collect, apple_pay, google_pay, amazon_pay, klarna, affirm, afterpay_clearpay, cashapp, multibanco, bancontact_card, eps, ideal, przelewy24, paypal, sunbitExample: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.
Display previously saved payment methods for returning customers, improving checkout speed and user experience.
Session Management
Session Management
URL to redirect customers after payment completion. Dodo Payments appends the following query parameters to your URL on redirect:
Example redirect URLs:
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.
If true, finalizes all session details immediately. API will throw an error if required data is missing.
Apply one or more stacked discount codes to the checkout session. Codes are applied in array order (the first code reduces the base price, the second reduces the already-discounted price, and so on), up to a maximum of 20 codes per session.
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.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.Custom key-value pairs to store additional information about the session.
Override merchant default 3DS behaviour for this session.
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
UI Customization & Features
UI Customization & Features
Custom Fields
Custom Fields
Kumpulkan informasi tambahan dari pelanggan selama checkout dengan bidang formulir kustom. Anda dapat mendefinisikan hingga 5 bidang kustom per sesi checkout. Respon pelanggan disertakan dalam payload webhook dan tersedia melalui API.
Respon pelanggan terhadap bidang kustom disertakan dalam:
- Webhooks:
payment.succeeded,subscription.active, dan payload acara relevan lainnya mengandung arraycustom_field_responses - Respons API: Objek pembayaran dan langganan mencakup
custom_field_responses
Subscription Configuration
Subscription Configuration
Konfigurasi tambahan untuk sesi checkout yang berisi produk berlangganan.
Contoh Penggunaan
Berikut adalah 10 contoh komprehensif yang menunjukkan berbagai konfigurasi sesi checkout untuk berbagai skenario bisnis:1. Checkout Produk Tunggal Sederhana
2. Keranjang Multi-Produk
3. Langganan dengan Periode Percobaan
4. Checkout yang Dikonfirmasi Sebelumnya
Ketika
confirm diatur ke true, pelanggan akan langsung dibawa ke halaman checkout, melewati langkah konfirmasi.5. Checkout dengan Override Mata Uang
Override
billing_currency hanya berlaku ketika mata uang adaptif diaktifkan di pengaturan akun Anda. Jika mata uang adaptif dinonaktifkan, parameter ini tidak akan berpengaruh.6. Metode Pembayaran Tersimpan untuk Pelanggan yang Kembali
7. Checkout B2B dengan Pengumpulan ID Pajak
8. Checkout Tema Gelap dengan Kode Diskon Tumpuk
9. Metode Pembayaran Regional (UPI untuk India)
Untuk informasi mendetail tentang konfigurasi dan pengujian UPI, lihat halaman Metode Pembayaran India.10. BNPL (Beli Sekarang Bayar Nanti) Checkout
Untuk informasi mendetail tentang configurasi dan pengujian BNPL, lihat halaman Beli Sekarang Bayar Nanti (BNPL).11. Menggunakan Metode Pembayaran yang Ada untuk Checkout Instan
Gunakan metode pembayaran yang disimpan pelanggan untuk membuat sesi checkout yang diproses segera, melewati pengumpulan metode pembayaran:Metode pembayaran harus menjadi milik pelanggan dan kompatibel dengan mata uang pembayaran. Ini memungkinkan pembelian satu klik untuk pelanggan yang kembali.
12. Tautan Pendek untuk URL Pembayaran yang Lebih Bersih
Buat tautan pembayaran pendek yang dapat dibagikan dengan slug kustom:13. Lewati Halaman Sukses Pembayaran dengan Pengalihan Langsung
Alihkan pelanggan segera setelah penyelesaian pembayaran, melewati halaman sukses default:Saat
redirect_immediately diaktifkan, pelanggan dialihkan ke return_url segera setelah penyelesaian pembayaran, melewati halaman sukses default sepenuhnya.14. Memaksa Bahasa
Paksakan checkout untuk ditampilkan dalam bahasa tertentu, menggantikan deteksi bahasa browser pelanggan: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. Mengumpulkan Bidang Kustom
Kumpulkan informasi tambahan dari pelanggan selama checkout menggunakan bidang kustom:Respon bidang kustom otomatis disertakan dalam payload webhook (
payment.succeeded, subscription.active, dll.) dan dapat diambil melalui API. Gunakan mereka untuk memperkaya CRM Anda, memicu alur onboarding, atau menyesuaikan pengalaman pelanggan.text, number, email, url, date, dropdown, boolean
Pratinjau Sesi Checkout
Sebelum membuat sesi checkout, Anda dapat mempratinjau rincian harga termasuk pajak, diskon, dan total. Ini berguna untuk menampilkan harga yang akurat kepada pelanggan sebelum mereka melanjutkan ke checkout.- Node.js SDK
- Python SDK
Preview API Reference
Lihat dokumentasi endpoint pratinjau lengkap.
Berpindah dari Tautan Dinamis ke Sesi Checkout
Perbedaan Kunci
Sebelumnya, saat membuat tautan pembayaran dengan Tautan Dinamis, Anda diharuskan menyediakan alamat penagihan lengkap pelanggan. Dengan Sesi Checkout, hal ini tidak lagi diperlukan. Anda dapat menyampaikan informasi apa pun yang Anda miliki, dan kami akan menanganinya. Sebagai contoh:- Jika Anda hanya mengetahui negara penagihan pelanggan, hanya berikan itu.
- Alur checkout secara otomatis akan mengumpulkan detail yang hilang sebelum memindahkan pelanggan ke halaman pembayaran.
- Di sisi lain, jika Anda sudah memiliki semua informasi yang diperlukan dan ingin langsung ke halaman pembayaran, Anda dapat menyampaikan data lengkap dan menyertakan
confirm=truedalam body permintaan Anda.
Proses Migrasi
Migrasi dari Tautan Dinamis ke Sesi Checkout adalah mudah:1
Update your integration
Perbarui integrasi Anda untuk menggunakan metode API atau SDK yang baru.
2
Adjust request payload
Sesuaikan payload permintaan sesuai dengan format Sesi Checkout.
3
That's it!
Ya. Tidak diperlukan penanganan tambahan atau langkah migrasi khusus di pihak Anda.
Referensi API Terkait
Create Checkout Session
Referensi API lengkap untuk membuat sesi checkout dengan semua parameter dan opsi yang tersedia
Preview Checkout Session
Referensi API untuk pratinjau harga, pajak, dan total sebelum membuat sesi