# Discord Linking

### **Step 1: Creating a Discord Server Integration**

1. Navigate to **Integrations > Discord Servers** in your PayNow dashboard.
2. Click the **“Add Discord Server”** button.
3. A window will appear with instructions to:
   * **Add the official PayNow Discord Bot** to your Discord server.
   * Copy the provided **registration command** (e.g., `/pnregister <unique_id>`) and run it on your Discord server.
4. Once completed, the Discord server will be **linked** to your PayNow account and will appear in the list.

***

### **Step 2: Connecting the PayNow Bot to Your Discord Server**

1. Click the **"Add Bot"** button.
2. Authorize the **PayNow Bot** to join your Discord server.
3. Make sure the bot's **role is above** the roles you want it to manage.
4. After the bot has been added, run the following command in any channel:

   ```bash
   /pnregister <unique_id>
   ```
5. Once registered, your Discord server will be linked to PayNow.

***

### **Step 3: Assigning Discord Roles in Deliverable Actions**

After linking your Discord server, you can **automate role assignments** through the **Deliverable Actions** when setting up a product.

1. Navigate to **Content > Products** in your dashboard.
2. Click **"Create Product"** or edit an existing product.
3. Scroll down to the **Deliverable Actions** section.
4. Click **"Add Action"** and select **"Assign Discord Role"**.
5. Choose your **Discord Game Server** from the dropdown.
6. Select the **role** that will be assigned upon purchase.
7. Click **Save** to update the product.

{% hint style="info" %}
Customers who purchase this product will automatically receive the selected role in your Discord server.
{% endhint %}

***

### **Step 4: Managing Discord-Based Purchases**

* **Roles are only removed when a package expires** if an **On Expiry Action** is set to remove them.
* **Manually revoking access to a package will remove the assigned Discord role.**

***

## **FAQs**

#### Can I link multiple Discord servers?

Yes! You can create multiple **Discord server integrations**, just like game servers.

#### What permissions does the bot need?

The bot requires **Manage Roles** permission to assign roles and **Read Messages** to process commands.

> **Note:** The required permissions are **automatically requested** when inviting the bot, so no manual adjustments should be needed unless permissions are later changed in Discord.

#### Will roles be removed if I manually revoke a package?

Yes, roles will be removed if you manually revoke a package. The bot will automatically remove the assigned Discord roles upon revoking.

#### What happens if a user leaves the server?

If a user leaves and rejoins, the bot **will automatically reassign their role** as long as their package is still active and has not expired. It syncs their role to match the **current state of their package**.
