Discord 权限在客户的订阅激活或一次性购买完成时,将其添加到您的服务器(并可选地分配一个角色)。取消、退款和计划更改会自动撤销角色。
交付内容
- 客户通过其递送邮件或客户门户中的 OAuth 链接连接其 Discord 账户。
- 一旦授权,Dodo Payments 将他们添加到您的服务器(或找到其现有成员资格),并分配您配置的角色。
- 如果未选择特定角色,仅授予服务器成员身份。
连接 Discord
1
Open Entitlements
在您的 Dodo Payments 仪表板中,转到 Entitlements 并点击 + 来开始新的权限。
2
Pick Discord
选择 Discord Access 作为集成。如果尚未为您的业务连接 Discord,系统将提示您 Connect Discord。
点击后会在新标签页中打开 Discord。登录,选择您要管理的服务器,并确认该服务器上的机器人的权限(管理角色、踢出成员、创建邀请)。

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

Connect Discord prompt before the OAuth handoff.


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

Server connected — return to the Dodo Payments dashboard to continue.
3
Pick a server and role
返回仪表板,选择您刚连接的 server(公会)。可选择一个 role 在交付时分配,或将其留空以仅授予服务器成员资格。给权限一个 name 然后点击 Create Entitlement。

4
Save the entitlement
保存权限。现在可以附加到任何产品上。
客户流程
- 客户完成结账。
- Dodo Payments 创建一个处于
Pending状态的 grant。其oauth_url在此时为null,直到客户开始 accept 流程;此时其中会填充 Discord authorization URL。 - 客户会收到一封包含“加入 Discord”按钮(OAuth 链接)的电子邮件。该链接也会显示在其 Customer Portal 中。
- 客户完成授权后,bot 会将其添加到 server 并分配配置的 role。grant 会转为
Delivered。 - 如果 subscription 被取消、暂停或过期,或者 merchant 手动撤销,bot 会移除该 role,grant 会转为
Revoked。
必要配置
通过 API 创建
Webhooks
订阅entitlement_grant.* webhook 事件 以跟踪 Discord 授权:
entitlement_grant.created会以status: "Pending"触发。此时oauth_url为null— 客户从 delivery email 或 Customer Portal 开始 accept 流程后,其中才会填充内容。entitlement_grant.delivered会在 role 分配后触发。entitlement_grant.revoked会在 role 移除后触发。
故障排除
Customer never sees the role assigned
Customer never sees the role assigned
grant 会一直处于
Pending 状态,直到客户完成 OAuth 流程。检查 entitlement 的 grants 列表,确认客户是否点击了 OAuth 链接。如有需要,请重新发送交付电子邮件。Grant moves to failed with permission errors
Grant moves to failed with permission errors
确保 Dodo Payments 机器人保留在服务器中,拥有
Manage Roles 权限,并且位于分配角色的上方。重新保存权限会重新运行验证。Customer cancelled but still has the role
Customer cancelled but still has the role
Discord 会立即传播角色移除,但客户的本地 Discord 客户端可能会缓存。他们应该重新连接或刷新;服务器端状态是正确的。