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的授予,并附带一个指向 Discord 的oauth_url链接。 - 客户收到一封带有“加入 Discord”按钮(OAuth 链接)的邮件。该链接也在其客户门户中可见。
- 客户授权后,机器人会将他们加入服务器并分配配置的角色。授予状态移动到
delivered。 - 如果订阅被取消、暂停或到期,或者商家手动撤销,机器人会移除角色,授予状态移动到
revoked。
必要配置
通过 API 创建
Webhooks
订阅entitlement_grant.* webhook 事件 以跟踪 Discord 授权:
- 当
entitlement_grant.created触发时,包含一个status: "pending"和一个oauth_url供客户授权。 - 一旦角色分配完成,触发
entitlement_grant.delivered。 - 当角色被移除时,触发
entitlement_grant.revoked。
故障排除
Customer never sees the role assigned
Customer never sees the role assigned
授予将处于
pending,直到客户完成 OAuth 流程。检查权限的授予列表并确认他们是否点击了 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 客户端可能会缓存。他们应该重新连接或刷新;服务器端状态是正确的。