Overview
Inline checkout lets you create fully integrated checkout experiences that blend seamlessly with your website or application. Unlike the overlay checkout, which opens as a modal on top of your page, inline checkout embeds the payment form directly into your page layout. Using inline checkout, you can:- Create checkout experiences that are fully integrated with your app or website
- Let Dodo Payments securely capture customer and payment information in an optimized checkout frame
- Display items, totals, and other information from Dodo Payments on your page
- Use SDK methods and events to build advanced checkout experiences

How It Works
Inline checkout works by embedding a secure Dodo Payments frame into your website or app. The checkout frame handles collecting customer information and capturing payment details. Your page displays the items list, totals, and options for changing what’s on the checkout. The SDK lets your page and the checkout frame interact with each other. Dodo Payments automatically creates a subscription when a checkout completes, ready for you to provision.The inline checkout frame securely handles all sensitive payment information, ensuring PCI compliance without additional certification on your end.
What Makes a Good Inline Checkout?
It’s important that customers know who they’re buying from, what they’re buying, and how much they’re paying. To build an inline checkout that’s compliant and optimized for conversion, your implementation must include:
- Recurring information: If recurring, how often it recurs and the total to pay on renewal. If a trial, how long the trial lasts.
- Item descriptions: A description of what’s being purchased.
- Transaction totals: Transaction totals, including subtotal, total tax, and grand total. Be sure to include the currency too.
- Dodo Payments footer: The full inline checkout frame, including the checkout footer that has information about Dodo Payments, our terms of sale, and our privacy policy.
- Refund policy: A link to your refund policy, if it differs from the Dodo Payments standard refund policy.
Customer Journey
The checkout flow is determined by your checkout session configuration. Depending on how you configure the checkout session, customers will experience a checkout that may present all information on a single page or across multiple steps.Customer opens checkout
You can open inline checkout by passing items or an existing transaction. Use the SDK to show and update on-page information, and SDK methods to update items based on customer interaction.

Customer enters their details
Inline checkout first asks customers to enter their email address, select their country, and (where required) enter their ZIP or postal code. This step gathers all necessary information to determine taxes and available payment options.You can prefill customer details and present saved addresses to streamline the experience.
Customer selects payment method
After entering their details, customers are presented with available payment methods and the payment form. Options may include credit or debit card, PayPal, Apple Pay, Google Pay, and other local payment methods based on their location.Display saved payment methods if available to speed up checkout.

Checkout completed
Dodo Payments routes every payment to the best acquirer for that sale to get the best possible chance of success. Customers enter a success workflow that you can build.

Quick Start
Get started with the Dodo Payments Inline Checkout in just a few lines of code:Step-by-Step Integration Guide
Initialize the SDK for Inline Display
Initialize the SDK and specify
displayType: 'inline'. You should also listen for the checkout.breakdown event to update your UI with real-time tax and total calculations.Open the Checkout
Call
DodoPayments.Checkout.open() with the checkoutUrl and the elementId of your container:Test Your Integration
- Start your development server:
- Test the checkout flow:
- Enter your email and address details in the inline frame.
- Verify that your custom order summary updates in real-time.
- Test the payment flow using test credentials.
- Confirm redirects work correctly.
You should see
checkout.breakdown events logged in your browser console if you added a console log in the onEvent callback.Complete React Example
This example demonstrates how to implement a custom order summary alongside the inline checkout, keeping them in sync using thecheckout.breakdown event.
API Reference
Configuration
Initialize Options
| Option | Type | Required | Description |
|---|---|---|---|
mode | "test" | "live" | Yes | Environment mode. |
displayType | "inline" | "overlay" | Yes | Must be set to "inline" to embed the checkout. |
onEvent | function | Yes | Callback function for handling checkout events. |
Checkout Options
| 选项 | 类型 | 必需 | 描述 |
|---|---|---|---|
checkoutUrl | string | Yes | 结账会话 URL。 |
elementId | string | Yes | 结账应呈现的 DOM 元素的 id。 |
options.showTimer | boolean | No | 显示或隐藏结账计时器。默认为 true。禁用时,会在会话过期时收到 checkout.link_expired 事件。 |
options.showSecurityBadge | boolean | No | 显示或隐藏安全徽章。默认为 true。 |
options.manualRedirect | boolean | No | 启用后,结账完成后不会自动重定向。相反,你会收到 checkout.status 和 checkout.redirect_requested 事件,以便自行处理重定向。 |
options.payButtonText | string | No | 支付按钮上显示的自定义文本。 |
options.fontSize | FontSize | No | 结账的全局字体大小。 |
options.fontWeight | FontWeight | No | 结账的全局字体粗细。 |
Methods
Open Checkout
Opens the checkout frame in the specified container.manualRedirect, handle the checkout completion in your onEvent callback:
Close Checkout
Programmatically removes the checkout frame and cleans up event listeners.Check Status
Returns whether the checkout frame is currently injected.Events
The SDK provides real-time events through theonEvent callback. For inline checkout, checkout.breakdown is particularly useful for syncing your UI.
| Event Type | Description |
|---|---|
checkout.opened | Checkout frame has been loaded. |
checkout.form_ready | Checkout form is ready to receive user input. Useful for hiding loading states and showing the checkout UI. |
checkout.breakdown | Fired when prices, taxes, or discounts are updated. |
checkout.customer_details_submitted | Customer details have been submitted. |
checkout.pay_button_clicked | Fired when the customer clicks the pay button. Useful for analytics and tracking conversion funnels. |
checkout.redirect | Checkout will perform a redirect (e.g., to a bank page). |
checkout.error | An error occurred during checkout. |
checkout.link_expired | Fired when the checkout session expires. Only received when showTimer is set to false. |
checkout.status | Fired when manualRedirect is enabled. Contains the checkout status (succeeded, failed, or processing). |
checkout.redirect_requested | Fired when manualRedirect is enabled. Contains the URL to redirect the customer to. |
Checkout Breakdown Data
Thecheckout.breakdown event provides the following data:
Checkout Status Event Data
WhenmanualRedirect is enabled, you receive the checkout.status event with the following data:
Checkout Redirect Requested Event Data
WhenmanualRedirect is enabled, you receive the checkout.redirect_requested event with the following data:
Understanding the Breakdown Event
Thecheckout.breakdown event is the primary way to keep your application’s UI in sync with the Dodo Payments checkout state.
When it fires:
- On initialization: Immediately after the checkout frame is loaded and ready.
- On address change: Whenever the customer selects a country or enters a postal code that results in a tax recalculation.
| Field | Description |
|---|---|
subTotal | The sum of all line items in the session before any discounts or taxes are applied. |
discount | The total value of all applied discounts. |
tax | The calculated tax amount. In inline mode, this updates dynamically as the user interacts with the address fields. |
total | The mathematical result of subTotal - discount + tax in the session’s base currency. |
currency | The ISO currency code (e.g., "USD") for the standard subtotal, discount, and tax values. |
finalTotal | The actual amount the customer is charged. This may include additional foreign exchange adjustments or local payment method fees that aren’t part of the basic price breakdown. |
finalTotalCurrency | The currency in which the customer is actually paying. This can differ from currency if purchasing power parity or local currency conversion is active. |
- Currency Formatting: Prices are always returned as integers in the smallest currency unit (e.g., cents for USD, yen for JPY). To display them, divide by 100 (or the appropriate power of 10) or use a formatting library like
Intl.NumberFormat. - Handling Initial States: When the checkout first loads,
taxanddiscountmay be0ornulluntil the user provides their billing information or applies a code. Your UI should handle these states gracefully (e.g., showing a dash—or hiding the row). - The “Final Total” vs “Total”: While
totalgives you the standard price calculation,finalTotalis the source of truth for the transaction. IffinalTotalis present, it reflects exactly what will be charged to the customer’s card, including any dynamic adjustments. - Real-time Feedback: Use the
taxfield to show users that taxes are being calculated in real-time. This provides a “live” feel to your checkout page and reduces friction during the address entry step.
Implementation Options
Package Manager Installation
Install via npm, yarn, or pnpm as shown in the Step-by-Step Integration Guide.CDN Implementation
For quick integration without a build step, you can use our CDN:更新支付方式
内联结账支持订阅的支付方式更新。当客户需要更新支付方式——无论是针对活动订阅还是重新激活搁置的订阅——你都可以在页面布局中直接呈现更新流程。工作原理
- 调用 更新支付方式 API 来获取
payment_link:
- 将返回的
payment_link作为checkoutUrl传递,以打开内联结账:
针对搁置订阅
当为on_hold 状态的订阅更新支付方式时,Dodo Payments 会自动为任何剩余费用创建一笔收费。监控 payment.succeeded 和 subscription.active Webhook 以确认重新激活。
错误处理
SDK 通过事件系统提供详细的错误信息。请务必在你的onEvent 回调中实施适当的错误处理:
最佳实践
- 响应式设计:确保容器元素有足够的宽度和高度。iframe 通常会扩展以填充其容器。
- 同步:使用
checkout.breakdown事件,使你的自定义订单摘要或定价表与结账框架中的内容保持一致。 - 骨架状态:在容器中显示加载指示器,直到触发
checkout.opened事件。 - 清理:在组件卸载时调用
DodoPayments.Checkout.close(),以清理 iframe 和事件监听器。
对于深色模式实现,建议使用
#0d0d0d 作为背景色,以便与内联结账框架达到最佳视觉融合。支付状态验证
为什么必须进行服务器端验证
虽然类似checkout.status 的内联结账事件能提供实时反馈,但它们不应成为你判断支付状态的唯一依据。网络问题、浏览器崩溃或用户关闭页面可能导致事件丢失。为确保支付验证可靠:
- 你的服务器应监听 webhook 事件 - Dodo Payments 会为支付状态更改发送 webhook
- 实施轮询机制 - 你的前端应轮询服务器以获取状态更新
- 结合两种方式 - 将 webhook 作为主要来源,轮询作为备用
推荐架构
实施步骤
1. 监听结账事件 - 当用户点击支付时,开始准备验证状态:payment.succeeded 或 payment.failed webhook 时更新数据库。详情请参阅我们的 Webhook 文档。
处理重定向(3DS、Google Pay、UPI)
在使用manualRedirect: true 时,某些支付方式需要将用户重定向离开你的页面以进行认证:
- 3D 安全 (3DS) - 卡片认证
- Google Pay - 某些流程下的钱包认证
- UPI - 印度支付方式重定向
checkout.redirect_requested 事件。将用户重定向到指定的 URL:
- 检查用户是否从重定向返回(例如,通过
sessionStorage) - 开始轮询你的服务器以获取已确认的支付状态
- 在轮询期间显示“正在验证付款…”状态
- 根据服务器确认的状态显示成功/失败的 UI
故障排除
Checkout frame is not appearing
Checkout frame is not appearing
- 确保
elementId与实际存在于 DOM 中的div的id匹配。 - 确保
displayType: 'inline'已传递给Initialize。 - 检查
checkoutUrl是否有效。
Taxes are not updating in my UI
Taxes are not updating in my UI
- 确保你正在监听
checkout.breakdown事件。 - 只有在用户在结账框架中输入有效的国家和邮政编码之后,才会计算税费。
启用数字钱包
有关设置 Apple Pay、Google Pay 及其他数字钱包的详细信息,请参阅 数字钱包 页面。Apple Pay 快速设置
Download domain association file
Request activation
将你的生产域名 URL 邮件发送至 support@dodopayments.com 并请求激活 Apple Pay。
浏览器支持
Dodo Payments Checkout SDK 支持以下浏览器:- Chrome (latest)
- Firefox (latest)
- Safari (latest)
- Edge (latest)
- IE11+
内联结账与覆盖式结账
为你的用例选择合适的结账类型:| 功能 | 内联结账 | 覆盖式结账 |
|---|---|---|
| 集成深度 | 完全嵌入页面 | 页面之上的模态 |
| 布局控制 | 完全控制 | 有限 |
| 品牌呈现 | 无缝 | 与页面分离 |
| 实施工作量 | 较高 | 较低 |
| 适用场景 | 自定义结账页、高转化流程 | 快速集成、已有页面 |
相关资源
Overlay Checkout
使用覆盖式结账实现快速的基于模态的集成。
Checkout Sessions API
创建结账会话以驱动你的结账体验。
Webhooks
使用 webhook 在服务器端处理支付事件。
Integration Guide
完整的 Dodo Payments 集成指南。
