Skip to main content

介绍

Dodo Payments for WooCommerce 插件会将 Dodo Payments 添加为您商店结账时的付款方式。客户会在 Dodo Payments 结账页面上付款,该页面会根据客户所在位置、货币和设备显示可用的付款方式,例如银行卡、数字钱包和 UPI。随后,Dodo Payments 发送的 webhook 会更新 WooCommerce 中的订单状态。
该插件要求 WordPress 6.1 或更高版本、PHP 7.4 或更高版本,以及 WooCommerce 7.9 或更高版本。要销售订阅,您还需要 WooCommerce Subscriptions 扩展。
该插件适用于经典 WooCommerce 结账。它不支持基于区块的结账或实体商品配送,并且每个订单只能接受一个百分比折扣码。

分步安装指南

  1. 从 GitHub 的最新版本中下载 dodo-payments-for-woocommerce.zip。

    Download Plugin

    获取最新版本的 Dodo Payments for WooCommerce 插件
    您也可以从 WordPress 插件目录安装该插件。在 Add Plugins 页面中搜索 Dodo Payments for WooCommerce,点击 Install Now,然后点击 Activate,并继续查看配置指南。

    WordPress Plugin Directory

    从 WordPress.org 安装 Dodo Payments for WooCommerce
  2. 以管理员身份登录您的 WordPress 网站。必须已安装并启用 WooCommerce。
  3. 前往 Plugins → Add New Plugin。
    WordPress admin sidebar with the Plugins menu open
  4. 点击 Upload Plugin。此时会显示上传表单。
    Add Plugins page with the Upload Plugin button
    Plugin upload form with a Browse button and an Install Now button
  5. 点击 Browse…,然后选择您下载的 zip 文件。
  6. 点击 Install Now。
    Plugin upload form with the plugin zip file selected and the Install Now button
  7. 安装完成后,点击 Activate Plugin。您也可以稍后从 Plugins → Installed Plugins 中激活该插件。
    Plugin installed successfully message with the Activate Plugin button
  8. 插件已安装,但尚未配置。请继续查看下面的配置指南。

配置指南

设置 API 密钥和 Webhook

该插件需要从每个 Dodo Payments 模式中获取两个值:用于创建结账的 API 密钥,以及用于验证更新订单的 webhook 的 webhook signing key。以下步骤用于设置 live mode。
  1. 前往 WooCommerce → Settings → Payments,或点击侧边栏中 WooCommerce 下的 Payments。
    WooCommerce payment settings with Dodo Payments active and a Manage button
    WooCommerce sidebar menu with Payments highlighted
  2. 如果 Dodo Payments 尚未启用,请将其开启,然后点击 Manage。
  3. 插件设置会打开,每个选项下方都有说明。确认已选择 Enable Dodo Payments,然后先设置 Live API Key。
    Dodo Payments plugin settings with the Enable/Disable, Title, Description, Instructions, Test Mode, and Live API Key fields
  4. 在 Dodo Payments dashboard 中,打开侧边栏里的 Live Mode 开关。前往 Developer → API Keys,或使用此直接链接,然后点击 Add API key。
    Dodo Payments API Keys page with no keys and an Add API key button
  5. 输入密钥名称,例如 WooCommerce Plugin,然后点击 Create。
    Create New API dialog with the key name WooCommerce Plugin and a Create button
  6. 点击 Copy API Key。dashboard 只会显示一次密钥。将其粘贴到插件设置中的 Live API Key。
    New API key dialog with the Copy API Key and Close buttons
    Live API Key field in the plugin settings
  7. 接下来设置 webhook signing key。Dodo Payments 会通过 webhook 向你的商店发送支付更新,插件使用该密钥验证每个 webhook 是否来自 Dodo Payments。
  8. 在插件设置底部的 Webhook Endpoint 下,复制 URL。其格式为 https://your-store.com/?wc-api=dodo_payments。
    Webhook Endpoint URL at the bottom of the plugin settings, above the Save changes button
  9. 在 Dodo Payments dashboard 中,保持 live mode,前往 Developer → Webhooks,然后点击 Add endpoint。
    Webhooks page in live mode with no endpoints and an Add endpoint button
  10. 将第 8 步中的 URL 粘贴到 Endpoint URL。将 Subscribed events 留空即可接收所有事件,也可以仅选择支付、退款和订阅事件,这些是插件会处理的事件。然后点击 Create endpoint。
    Add endpoint dialog with the WooCommerce webhook URL in Endpoint URL
  11. endpoint 的 Overview 标签页会打开。在 Signing secret 下,点击眼睛图标显示密钥,然后点击复制图标。
    Endpoint Overview tab with the hidden signing secret, the reveal and copy icons, and Rotate secret
  12. 将密钥粘贴到插件设置中的 Live Webhook Signing Key,然后点击 Save changes。
    Live Webhook Signing Key field in the plugin settings
  13. 查看 Global Tax Category 和 All Prices are Tax Inclusive。插件在 Dodo Payments 中创建产品时会应用这些设置,这发生在客户首次使用该产品结账时。此后,产品会保留其在 Dodo Payments dashboard 中的税费设置,你可以按产品修改这些设置。只有在 Test Mode 下才需要 Test API Key 和 Test Webhook Signing Key。
    Test API Key, Test Webhook Signing Key, Global Tax Category, and All Prices are Tax Inclusive settings
在 Checkout Feature Flags 下,你还可以控制 Dodo Payments checkout 页面中的选项,例如 Allow Currency Selection 和 Allow Discount Codes。设为 Default 的 flag 不会被发送,因此 Dodo Payments 会应用其自身的默认值。
要进行测试支付,请在插件设置中开启 Test Mode。插件随后会使用 Test API Key 和 Test Webhook Signing Key,并连接到 Dodo Payments 测试环境。Test mode 使用独立的 API keys 和 webhook endpoints。要获取这些配置,请关闭 dashboard 中的 Live Mode 开关,在 test mode 下按照第 4 步至第 12 步操作,然后将相应值粘贴到测试字段中。正式上线前请关闭 Test Mode。

一切就绪!

客户现在可以在结账时选择 Dodo Payments。
WooCommerce checkout page with the billing form and the Place order button
客户下单后,插件会将其发送到 Dodo Payments checkout 页面进行支付。支付完成后,Dodo Payments 会发送 webhook,插件则会更新订单状态。
Dodo Payments checkout page with card, UPI QR code, and UPI ID payment options

主要功能

  • Hosted Checkout:客户在 Dodo Payments checkout 页面上支付,然后返回你商店的订单确认页面。
  • Multiple Payment Methods:checkout 会根据每位客户所在的位置、货币和设备,显示可用的支付方式。
  • Order Status Sync:随着支付状态变化,webhook 会将订单设置为 Completed、Processing、Failed 或 Cancelled。支付失败和取消的订单会将商品返还库存。
  • Refunds:在 Dodo Payments dashboard 中发起退款。退款成功后,插件会将订单设置为 Refunded。
  • Subscriptions:使用 WooCommerce Subscriptions 时,状态变化会双向同步,包括订阅被取消、暂停或重新激活的情况。WooCommerce 中对订阅日期的更改不会同步。
  • Order Notes:插件会为每个 checkout session、状态变化和错误添加订单备注,因此你可以从订单页面跟踪每笔支付。
  • Multi-currency Support:产品会以 WooCommerce 商店货币同步到 Dodo Payments。Allow Currency Selection flag 控制客户是否可以在 checkout 时更改货币。

故障排除

常见问题

  1. Payment Processing Failures
    • 检查 API key 是否与插件模式匹配。当 Test Mode 关闭时,插件使用 Live API Key,该 key 必须来自处于 live mode 的 dashboard。当 Test Mode 开启时,插件使用 Test API Key。
    • 检查订单备注。插件无法创建 checkout 时,会添加包含错误信息的备注,例如以 Dodo Payments Error: 开头的错误。
    • 如果 Dodo Payments 没有出现在 checkout 中,请确认 checkout 页面使用的是 classic checkout,而不是 Checkout block。
    • 如果订单包含 discount code,请确认它是单个百分比 code。
    • 账户通过 Account Verification 后,live payments 才会开始。
  2. Webhook Synchronization Problems
    • 检查 Endpoint URL 是否与插件设置中 Webhook Endpoint 下的 URL 完全一致。
    • 检查插件中的 signing key 是否与 endpoint 的 Signing secret 匹配,并确认两者来自同一模式。
    • 检查 PHP error log 中是否有以 Dodo Payments: 开头的行,例如 Dodo Payments: Could not verify webhook event。在 live mode 下,即使验证失败,插件也会返回 200,因此 Dodo Payments logs 会将投递显示为成功。在 Test Mode 下,插件会返回 401。
    • 检查网站是否有有效的 SSL certificate。Endpoint URL 仅接受 HTTPS URLs。
    • 检查服务器、防火墙和 security plugins 是否允许来自 Dodo Payments IP addresses 的 POST requests 访问 webhook URL。
    • 在 Developer → Webhooks 中打开 Logs 标签页,查看每次投递以及网站的响应。

支持资源

如需更多帮助:

维护最佳实践

  1. 发布新版本后更新插件,以获取安全修复和新功能。
  2. 在进行 live payments 前,在 Test Mode 中测试所有支付流程。
  3. 保持 WordPress 和 WooCommerce 为最新版本。
  4. 定期备份网站。
  5. 关注订单和 Dodo Payments dashboard 中的异常活动。
  6. 安全存储 API keys,切勿公开分享。
最后修改于 2026年9月26日