Langsung ke konten utama

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

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.
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). Both options use 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

product_cart
array
wajib
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.
customer
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.
billing_address
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.
allowed_payment_method_types
array
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, sunbit
Critical: Always include credit and debit as fallback options to prevent checkout failures when preferred payment methods are unavailable.
Example:
billing_currency
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.
show_saved_payment_methods
boolean
default:"false"
Display previously saved payment methods for returning customers, improving checkout speed and user experience.
return_url
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.
cancel_url
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.
confirm
boolean
default:"false"
If true, finalizes all session details immediately. API will throw an error if required data is missing.
discount_codes
array
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.
discount_code
string
usang
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.
metadata
object
Custom key-value pairs to store additional information about the session.
force_3ds
boolean
Override merchant default 3DS behaviour for this session.
minimal_address
boolean
default:"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.
customization
object
Customize the appearance and behavior of the checkout interface.
feature_flags
object
Configure specific features and behaviors for the checkout session.
custom_fields
array
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 array custom_field_responses
  • Respons API: Objek pembayaran dan langganan mencakup custom_field_responses
subscription_data
object
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:
Ketika menggunakan payment_method_id, confirm harus diatur ke true dan customer_id yang sudah ada harus disediakan. Metode pembayaran akan divalidasi untuk kelayakan dengan mata uang 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:
Tautan pendek sangat cocok untuk berbagi melalui SMS, email, atau media sosial. Mereka lebih mudah diingat dan membangun kepercayaan pelanggan lebih baik daripada URL panjang.

13. Lewati Halaman Sukses Pembayaran dengan Pengalihan Langsung

Alihkan pelanggan segera setelah penyelesaian pembayaran, melewati halaman sukses default:
Gunakan redirect_immediately: true saat Anda memiliki halaman sukses kustom yang memberikan pengalaman pengguna lebih baik daripada halaman sukses pembayaran default. Ini sangat berguna untuk aplikasi seluler dan alur checkout tertanam.
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:
Gunakan force_language saat Anda tahu bahasa pilihan pelanggan (misalnya, dari pengaturan akun mereka) atau saat menargetkan pasar regional tertentu.
Bahasa yang Didukung: 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. 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.
Jenis bidang tersedia: 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.

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=true dalam 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
Terakhir diubah pada 9 Juli 2026