---
title: "Discord Login and Purchase Roles from PLN 999 | VulCode"
description: "Discord login on your site and panel, roles granted after a purchase, role sync and webhook notifications within API limits. From PLN 999, 2-3 days."
url: "https://vulcode.com/en/services/integrations/discord"
lang: "en"
---

[Home](https://vulcode.com/en)[Services](https://vulcode.com/en/services)[Integrations](https://vulcode.com/en/services/integrations)

# Discord integration: login, roles after purchase and webhooks

VulCode, a software house from Cracow, Poland, ties Discord into the website, store and panel of game servers and communities. A player signs in with a Discord account, after a paid purchase a bot gives them a role, and when it expires the bot takes it away. Orders go to channels by webhook, and everything stays within Discord's API limits. The Discord integration costs from PLN 999 (about EUR 220) and usually takes 2-3 days, and the free quote comes back within an hour.

[Free quote](https://vulcode.com/en/quote)[Full pricing](https://vulcode.com/en/services/pricing)

- OAuth2 with the identify scope gives the player profile with no password on your site.

- A bot with MANAGE_ROLES grants and removes roles after store events.

For game servers and communities, Discord is where the players actually are. The integration ties it to the store, panel and player account.

- We build and run Discord bots for tickets, welcomes, email verification and role management, and send all webhook traffic through a queue that respects Discord's limits. They are in our [integrations portfolio](https://vulcode.com/en/portfolio/integrations).

- We cover bots with commands and server automation separately on the [Discord bots](https://vulcode.com/en/services/discord-bots) page. This page is about connecting Discord with your site, store or panel.

## Login, joining the server and a role

An OAuth2 run with the identify and guilds.join scopes. Hover a step to highlight it.

**Player****Your site****Discord OAuth2****Bot on the server**

Player → Your site

clicks "Sign in with Discord"

Your site → Discord OAuth2

redirect with scopes and a state parameter

Discord OAuth2 → Your site

an authorisation code and the same state

Your site → Discord OAuth2

exchange the code for a token

Your site → Bot on the server

add the player to the server with a role

player token and bot token

Bot on the server → Player

the player is on the server with a rank

- **The state parameter**: Discord does not require it but strongly recommends it. Without it, login is open to CSRF, so we always check it.
- **The bot already on the server**: Only a bot of the same application that is on the server and may create invites can add a player.

## Discord limits that decide stability

From the Rate Limits docs. Breaching the last one means a temporary block of the whole IP.

JSON application/json

```
[
                {
                "Limit": "Per route","Value": "varies, in X-RateLimit-* headers","What we do": "We read the headers and group requests by bucket."
                },
              
                {
                "Limit": "Global","Value": "50 requests per second per bot","What we do": "A queue with a steady pace, also for bulk role grants."
                },
              
                {
                "Limit": "Invalid requests","Value": "10,000 responses of 401, 403 and 429 per 10 minutes","What we do": "We never retry 401 and 403, and retry 429 only after waiting."
                },
              
                {
                "Limit": "A webhook returning 404","Value": "must not be used again","What we do": "We remove it from config and alert support."
                },
              
                {
                "Limit": "Message","Value": "up to 10 embeds, 6,000 characters in total","What we do": "We split long reports into several messages."
                }
              ]
```

The same record in the interface

Limit 5

- Per route Value varies, in X-RateLimit-* headers What we do We read the headers and group requests by bucket.

- Global Value 50 requests per second per bot What we do A queue with a steady pace, also for bulk role grants.

- Invalid requests Value 10,000 responses of 401, 403 and 429 per 10 minutes What we do We never retry 401 and 403, and retry 429 only after waiting.

- A webhook returning 404 Value must not be used again What we do We remove it from config and alert support.

- Message Value up to 10 embeds, 6,000 characters in total What we do We split long reports into several messages.

## What flows between your system and Discord

A typical set for a game server or community with paid ranks.

**Site, store, panel** **Discord**

### Player profile

Discord login

### Rank role

a paid purchase

### Role removal

expiry or a refund

### Channel notification

an order, a ticket, an outage

via webhook, no bot needed

### Linked role data

a change in level or playtime

## Three ways to grant roles

The choice depends on whether the role comes from a purchase or from player data.

|  | The bot grants the role | Linked roles | By hand |
| --- | --- | --- | --- |
| Works right after purchase | Yes | Partly | No |
| The player must link an account | only at first login | yes, through a verification page | no |
| Removal on expiry | Yes | Partly | No |
| Constraints | the bot's role must sit above the granted one | max. 5 data fields per app | moderators' time |

With linked roles the server sets the condition, e.g. level 10 or more, and the app only updates player data through the API.

## What we watch out for with Discord

The most common reasons a role does not arrive or the bot gets blocked.

- Permissions
  ### Role hierarchy
  A bot grants only roles below its own highest one. We set the role order with you at launch.

- ### Minimal scopes
  We ask the player only for the scopes we use. Every extra one puts people off signing in.

- ### A queue that respects 429
  Bulk operations, such as removing roles at season end, go at a pace Discord accepts.

- ### Daily role reconciliation
  We compare server roles with purchases, so a role granted by hand or lost does not live on.

## A webhook or a bot

Not every Discord integration needs a bot.

### A webhook is enough

- You only want channel notifications: orders, tickets, statuses.

- You need no roles or commands.

A webhook URL in config and clear embeds. The quickest rollout.

### A bot is needed

- Roles must depend on purchases or the player account.

- You want to add players to the server at login.

- Players should use commands.

A Discord app with a bot on the server and an operation queue on your side.

[Discord bots](https://vulcode.com/en/services/discord-bots)

## Example rollout: VIP ranks in a server item shop

Step by step.

- **Server**: A game server with an item shop and a Discord community
- **Today**: A moderator grants ranks by hand from a payment screenshot
- **Goal**: The rank on Discord and in game right after payment

- ### Discord login
  The player signs in to the shop with Discord, so we know whom to grant the role.

- ### Payment and role
  A confirmed payment adds the VIP role and the in-game rank from the same event.

- ### Expiry
  A daily job removes expired roles at a pace within the limits.

- ### Notifications
  Each purchase goes via webhook to the admin channel with the amount and rank.

Moderators stop granting ranks by hand, and the player gets the rank seconds after paying.

## Common questions about Discord integration

Click a question to see the answer.

**How much does the Discord integration cost?**

The Discord integration costs from PLN 999 (about EUR 220). The figure grows with the number of systems, data directions and exceptions to handle. A typical integration takes 2-3 days, and the free quote comes back within an hour. We quote it under our [API and integrations](https://vulcode.com/en/services/api-integrations) service.

**How long does it take?**

Usually 2-3 days. The exact dated schedule comes with the free quote, and if anything is going to move, you know in advance.

**Must the player already be on the server?**

No. With the guilds.join scope the bot can add them to the server at login, with the role straight away.

**What if the player leaves the server and comes back?**

The daily reconciliation or the join event restores the role if the purchase is still valid.

**Can you connect Discord to a hosting panel?**

Yes. Discord login and service notifications work the same way in a client panel, e.g. with [Pterodactyl](https://vulcode.com/en/services/integrations/pterodactyl).

**Will the Discord integration code be mine?**

Yes. Once the work is accepted and paid in full, the economic copyright in the code passes to you. You have access to the repository from the first day, and after acceptance you get it with run instructions. Open source libraries keep their own licences.

**How do you check the Discord integration before launch?**

On a test Discord server with a test bot, before anything reaches your server. We run real scenarios, including errors, cancellations and returns, and only then switch the integration on in production.

**What if the Discord integration stops working?**

The integration retries failed operations by itself and logs every one, and when the problem does not go away you get a notification. We fix bugs that come from our work under warranty, and you get 90 days of support included after launch.

**What if Discord changes its API?**

Discord announces changes in advance. We follow those notices and adapt the integration under a [maintenance](https://vulcode.com/en/services/website-maintenance) plan or as a separate short order, before the old version stops working.

## Sources

Technical details come from the Discord developer documentation.

- [OAuth2 and scopes](https://github.com/discord/discord-api-docs/blob/main/developers/topics/oauth2.mdx)

- [Rate limits](https://github.com/discord/discord-api-docs/blob/main/developers/topics/rate-limits.mdx)

- [Guild members and roles](https://github.com/discord/discord-api-docs/blob/main/developers/resources/guild.mdx)

- [Permission hierarchy](https://github.com/discord/discord-api-docs/blob/main/developers/topics/permissions.mdx)

- [Linked roles](https://github.com/discord/discord-api-docs/blob/main/developers/resources/application-role-connection-metadata.mdx)

## Related pages

Other integrations for games and communities.

- [**Discord bots** Bots with commands, tickets and automation.](https://vulcode.com/en/services/discord-bots)

- [**Steam** Steam login and player data.](https://vulcode.com/en/services/integrations/steam)

- [**Messengers and social media** Telegram, WhatsApp, Messenger, Instagram and TikTok.](https://vulcode.com/en/services/integrations/messengers)

- [**Google login and SSO** Google, Microsoft and SSO login.](https://vulcode.com/en/services/integrations/sso-login)

- [**Pterodactyl** Game server panel and billing.](https://vulcode.com/en/services/integrations/pterodactyl)

## Describe your project.

A free quote comes back within an hour during working hours.

### Rather skip the form?

Ask in the chat or write to us directly.

Open the chat

- **Email**: [hello@vulcode.com](mailto:hello@vulcode.com)
- **Phone**: [+48 576 043 920](tel:+48576043920)
- **Discord**: [discord.gg/vulcode](https://discord.gg/vulcode)

## More on this in our blog

- [Chat on your website: a widget, Messenger or straight into your team's Discord LiveChat costs $19 a month per user on annual billing, Messenger gives a business 24 hours to reply, and Discord accepts a message from your site without any bot. We compare three ways to talk to customers from your website.](https://vulcode.com/en/blog/website-chat-widget-messenger-discord)

- [Discord webhooks: store and panel notifications on your team's server A webhook posts a message to a Discord channel with no bot and no login, using nothing but its address. Here is how much one message can hold, how to lay out an order notification and why the webhook address stays on the server.](https://vulcode.com/en/blog/discord-webhook-notifications)
