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.الخيارات المتاحة:
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
جمع معلومات إضافية من العملاء أثناء الدفع باستخدام حقول النموذج المخصصة. يمكنك تعريف ما يصل إلى 5 حقول مخصصة لكل جلسة دفع. يتم تضمين ردود العملاء في تحميلات webhook ومتاحة عبر API.
تتضمن ردود العملاء على الحقول المخصصة في:
- Webhooks:
payment.succeeded,subscription.active، وpayloads الأحداث ذات الصلة الأخرى تحتوي على مصفوفةcustom_field_responses - استجابات API: تتضمن كائنات الدفع والاشتراك
custom_field_responses
Subscription Configuration
Subscription Configuration
إعدادات إضافية لجلسات الدفع التي تحتوي على منتجات الاشتراكات.
أمثلة الاستخدام
إليكم 10 أمثلة شاملة تعرض تكوينات مختلفة لجلسات الدفع لسيناريوهات العمل المختلفة:1. دفع بسيط لمنتج واحد
2. سلة متعددة المنتجات
3. اشتراك مع فترة تجريبية
4. دفع مؤكد مسبقاً
عندما يتم تعيين
confirm إلى true، سيتم نقل العميل مباشرة إلى صفحة الدفع، متجاوزاً أي خطوات تأكيد.5. الدفع مع تجاوز العملة
سيؤثر تجاوز
billing_currency فقط عندما يتم تمكين العملة التكيفية في إعدادات حسابك. إذا تم تعطيل العملة التكيفية، فلن يكون لهذا المعامل أي تأثير.6. طرق دفع محفوظة للعملاء العائدين
7. الدفع بين الشركات مع جمع معرف الضرائب
8. دفع بنمط داكن مع أكواد خصم مكدسة
9. طرق الدفع الإقليمية (UPI للهند)
لمزيد من المعلومات حول تكوين UPI والاختبار، انظر صفحة طرق الدفع في الهند.10. الدفع الآن والدفع لاحقاً (BNPL)
لمزيد من المعلومات حول تكوين BNPL والاختبار، انظر صفحة الدفع الآن والدفع لاحقاً (BNPL).11. استخدام طرق الدفع الحالية للدفع الفوري
استخدم طريقة الدفع المحفوظة للعميل لإنشاء جلسة دفع تتم على الفور، متخطية جمع معلومات طريقة الدفع:يجب أن تكون طريقة الدفع تابعة للعميل ومتوافقة مع عملة الدفع. هذا يمكّن العملاء العائدين من الشراء بنقرة واحدة.
12. روابط قصيرة للحصول على روابط دفع أنظف
توليد روابط دفع قصيرة وقابلة للمشاركة مع عناوين مخصصة:13. تخطي صفحة نجاح الدفع بإعادة التوجيه الفوري
إعادة توجيه العملاء مباشرة بعد إتمام الدفع، متجاوزاً صفحة النجاح الافتراضية:عندما يتم تمكين
redirect_immediately، يتم إعادة توجيه العملاء إلى return_url بعد إتمام الدفع مباشرةً، متجاوزين صفحة النجاح الافتراضية تماماً.14. فرض لغة معينة
إجبار الدفع ليظهر بلغة معينة، متجاوزاً كشف لغة متصفح العميل:ar)، الكتالونية (ca)، الصينية (zh)، الهولندية (nl)، الإنجليزية (en)، الفرنسية (fr)، الألمانية (de)، العبرية (he)، الإندونيسية (id)، الإيطالية (it)، اليابانية (ja)، الكورية (ko)، الملايوية (ms)، البولندية (pl)، البرتغالية (pt)، الرومانية (ro)، الروسية (ru)، الإسبانية (es)، السويدية (sv)، التايلاندية (th)، التركية (tr)
15. جمع الحقول المخصصة
جمع معلومات إضافية من العملاء أثناء الدفع باستخدام الحقول المخصصة:يتم تضمين ردود الحقول المخصصة تلقائيًا في تحميلات webhook (
payment.succeeded, subscription.active، إلخ.) ويمكن استردادها عبر API. استخدامها لإثراء إدارة علاقات العملاء، تشغيل تدفقات الإعداد، أو تخصيص تجربة العميل.text, number, email, url, date, dropdown, boolean
معاينة لجلسات الدفع
قبل إنشاء جلسة دفع، يمكنك معاينة تفاصيل الأسعار بما في ذلك الضرائب، الخصومات، والإجماليات. هذا مفيد لعرض أسعار دقيقة للعملاء قبل متابعة عملية الدفع.- Node.js SDK
- Python SDK
Preview API Reference
عرض وثائق نقطة النهاية الكاملة للمعاينة.
الانتقال من الروابط الديناميكية إلى جلسات الدفع
الاختلافات الرئيسية
في السابق، عند إنشاء رابط دفع باستخدام الروابط الديناميكية، كان يتعين عليك توفير عنوان الفواتير الكامل للعميل. مع جلسات الدفع، لم يعد ذلك ضرورياً. يمكنك ببساطة تمرير أي معلومات تمتلكها، وسنتولى نحن الباقي. على سبيل المثال:- إذا كنت تعرف فقط بلد فواتير العميل، فقط قدم ذلك.
- سيجمع تدفق الدفع تلقائياً التفاصيل المفقودة قبل نقل العميل إلى صفحة الدفع.
- من ناحية أخرى، إذا كان لديك جميع المعلومات المطلوبة بالفعل وترغب في التوجه مباشرة إلى صفحة الدفع، يمكنك تمرير مجموعة البيانات الكاملة وتضمين
confirm=trueفي طلبك.
عملية الانتقال
الانتقال من الروابط الديناميكية إلى جلسات الدفع بسيط:1
Update your integration
قم بتحديث التكامل الخاص بك لاستخدام الطريقة الجديدة لـ API أو SDK.
2
Adjust request payload
قم بتعديل حمولة الطلب وفقًا لتنسيق جلسات الدفع.
3
That's it!
نعم. لا يتطلب الأمر معالجة إضافية أو خطوات انتقال خاصة على جانبك.
المرجع الكامل لـ API ذو الصلة
Create Checkout Session
المرجع الكامل لإنشاء جلسات الدفع مع جميع المعلمات والخيارات المتاحة
Preview Checkout Session
مرجع API لمعاينة التسعير، الضرائب، والإجماليات قبل إنشاء جلسة