Skip to main content
Discord 权限在客户的订阅激活或一次性购买完成时,将其添加到您的服务器(并可选地分配一个角色)。取消、退款和计划更改会自动撤销角色。

交付内容

  • 客户通过其递送邮件或客户门户中的 OAuth 链接连接其 Discord 账户。
  • 一旦授权,Dodo Payments 将他们添加到您的服务器(或找到其现有成员资格),并分配您配置的角色。
  • 如果未选择特定角色,仅授予服务器成员身份。
此集成非常适合付费社区、支持者特权和分级访问渠道。

连接 Discord

1

Open Entitlements

在您的 Dodo Payments 仪表板中,转到 Entitlements 并点击 + 来开始新的权限。
2

Pick Discord

选择 Discord Access 作为集成。如果尚未为您的业务连接 Discord,系统将提示您 Connect Discord
New entitlement panel prompting the merchant to connect Discord

Connect Discord prompt before the OAuth handoff.

点击后会在新标签页中打开 Discord。登录,选择您要管理的服务器,并确认该服务器上的机器人的权限(管理角色、踢出成员、创建邀请)。
Discord OAuth screen asking which server to add the Dodo Payments bot toDiscord bot permission confirmation screen

Discord OAuth: pick the server, then confirm the bot's permissions on it.

当 Discord 重定向回来时,您会看到服务器已连接的确认信息。
Discord Access connected successfully confirmation page

Server connected — return to the Dodo Payments dashboard to continue.

3

Pick a server and role

返回仪表板,选择您刚连接的 server(公会)。可选择一个 role 在交付时分配,或将其留空以仅授予服务器成员资格。给权限一个 name 然后点击 Create Entitlement
New Entitlement - Discord Access form with connected server, server picker, role dropdown, and name field
4

Save the entitlement

保存权限。现在可以附加到任何产品上。

客户流程

  1. 客户完成结账。
  2. Dodo Payments 创建一个处于 Pending 状态的 grant。其 oauth_url 在此时为 null,直到客户开始 accept 流程;此时其中会填充 Discord authorization URL。
  3. 客户会收到一封包含“加入 Discord”按钮(OAuth 链接)的电子邮件。该链接也会显示在其 Customer Portal 中。
  4. 客户完成授权后,bot 会将其添加到 server 并分配配置的 role。grant 会转为 Delivered
  5. 如果 subscription 被取消、暂停或过期,或者 merchant 手动撤销,bot 会移除该 role,grant 会转为 Revoked
确保 Dodo Payments 机器人的角色位置在您授予的角色之上。Discord 不允许机器人分配比自己排名更高的角色。

必要配置

通过 API 创建

Webhooks

订阅 entitlement_grant.* webhook 事件 以跟踪 Discord 授权:
  • entitlement_grant.created 会以 status: "Pending" 触发。此时 oauth_urlnull — 客户从 delivery email 或 Customer Portal 开始 accept 流程后,其中才会填充内容。
  • entitlement_grant.delivered 会在 role 分配后触发。
  • entitlement_grant.revoked 会在 role 移除后触发。

故障排除

grant 会一直处于 Pending 状态,直到客户完成 OAuth 流程。检查 entitlement 的 grants 列表,确认客户是否点击了 OAuth 链接。如有需要,请重新发送交付电子邮件。
确保 Dodo Payments 机器人保留在服务器中,拥有 Manage Roles 权限,并且位于分配角色的上方。重新保存权限会重新运行验证。
Discord 会立即传播角色移除,但客户的本地 Discord 客户端可能会缓存。他们应该重新连接或刷新;服务器端状态是正确的。
最后修改于 2026年8月21日