Configuring Discord Purchase Roles¶
The extension's own settings page in Paymenter (the one with the Enabled switch) has no options. Everything is configured in two entries of the Extensions navigation group: Discord Settings and Discord Role Mappings.
Discord Settings¶
Discord Settings opens the edit form of the single settings record directly.
| Setting | Type | Default | What it does |
|---|---|---|---|
| Bot token | Password field, up to 255 characters | Empty | Token of the bot that reads members and changes roles. Required on first save. Stored encrypted. The field is always empty when you open the form; leave it blank to keep the stored token. |
| Default server (guild) ID | Text, 15 to 25 digits | Empty | The Discord server used by every mapping that has no server override. Required. |
| OAuth2 client ID | Text, up to 64 characters | Empty | Client ID of the Discord application customers authorize when they link their account. Required. |
| OAuth2 client secret | Password field, up to 255 characters | Empty | Client secret of the same application. Required on first save. Stored encrypted. Leave blank to keep the stored secret. The help text shows the redirect URI you must add in the Discord application. |
| While a service is suspended | Select: Keep the Discord role or Remove the Discord role | Keep the Discord role | With Keep, active and suspended services qualify for their mapped roles. With Remove, only active services qualify, so a suspended service is treated like an ended one. |
| Automatically join eligible customers to their servers | Toggle | Off | When on, linking asks the customer for identify and guilds.join instead of identify only, and a sync adds the customer to a server in which they qualify for at least one role. See Server join. |
| Last connection result | Read-only text | Empty | The problem found by the last Test connection, or empty if the last test passed. |
Linking and syncing work only when the bot token, a valid default server ID, the client ID and the client secret are all saved.
Saving a change to the bot token, the default server ID, the suspension setting or the server join toggle queues a role sync for every linked account and a cleanup for every pending ledger entry.
Warning
If you change Default server (guild) ID, roles the extension gave through mappings without a server override are removed in the old server and given in the new one at the next sync. The bot must still be a member of the old server to remove them.
Test connection¶
The Test connection button at the top of the form checks the saved values, so save first. It asks Discord for the bot user and then for the default server.
| Result | Meaning |
|---|---|
No bot token stored. |
No bot token is saved yet. |
The bot token was rejected by Discord. |
Discord did not accept the token, or Discord could not be reached. |
Bot "<name>" is reachable. followed by a note that the server could not be read |
The token works, but the bot cannot read the default server. Check the server ID and that the bot is a member. |
Bot "<name>" is reachable. on its own |
Token and default server are fine. |
The test only reads the default server. It does not check servers set as an override in a mapping, the Manage Roles permission or the position of the bot's role.
Server join¶
With Automatically join eligible customers to their servers on:
- The consent screen asks for
identifyandguilds.join. Customers who linked before you switched it on have not given that consent. They must use Reconnect / change Discord account on their Discord page once. - During a sync, a customer who is not a member of a server but qualifies for a role there is added to that server with their stored OAuth2 token. An expired token is renewed with the stored refresh token first.
- The bot must belong to the same Discord application as the OAuth2 client ID and needs Create Instant Invite in addition to Manage Roles in each server.
- If the server uses membership screening, no role is given until the customer has completed it.
- Customers are never removed from a server, not on cancellation and not on unlink.
Discord Role Mappings¶
One mapping connects one product with one role in one server. Click New Discord role mapping to create one.
| Field | Type | Default | What it does |
|---|---|---|---|
| Product | Select, searchable | None | The Paymenter product. Required. Add several mappings for the same product to give several roles or to cover several servers. |
| Server (guild) ID override | Text, 15 to 25 digits, optional | Empty | Leave blank to use the default server from Discord Settings. Fill it to give the role in another server. The same bot must be a member of that server. |
| Discord role ID | Text, 15 to 25 digits | None | The role to give. Required. The bot's role must be above it. |
| Remove the role when the service ends | Toggle | On | When on, the role is removed once the customer has no qualifying service left for it. When off, the role stays after the service ends. |
| Enabled | Toggle | On | A disabled mapping gives no roles and removes none. Roles it gave earlier stay in the ledger untouched until you enable or delete the mapping, or the account is unlinked. |
The list shows Server (or "Default server"), Product, Discord role ID, Removes role and Enabled, with Edit and Delete per row.
Creating, editing or deleting a mapping queues a role sync for every linked account.
How mappings combine:
- If several mappings point to the same role in the same server, the role is given once. It stays as long as the customer qualifies through any of them.
- If you delete a mapping, or change its role or server, the role it gave before is removed at the next sync, even if Remove the role when the service ends was off. It is kept only if another mapping still points to the same role in the same server and either the customer still qualifies through it or no enabled mapping for that role has removal switched on.
- The extension does not check that a role ID or server ID exists in Discord when you save. A wrong ID shows up as an error on the customer's row in Discord Accounts at the next sync.