Discord Integration
Automatically assign Discord roles when customers make purchases.
Overview
The Discord integration allows you to:
- Assign roles when products are purchased
- Remove roles when subscriptions expire
- Require Discord authentication at checkout
- Sync customer Discord accounts
How It Works
Pixlpay uses a Custom Discord Bot architecture for role delivery. You create your own Discord bot at the Discord Developer Portal, and Pixlpay handles all the interaction logic through Discord's HTTP Interactions system.
Customer Purchase
|
v
+------------------+
| Pixlpay |
| (queues role) |
+--------+---------+
|
v
Customer runs /claim in Discord
|
v
+------------------+
| Discord sends |
| interaction to |
| Pixlpay |
+--------+---------+
|
v
Pixlpay assigns role using your bot token
|
v
Customer receives role instantly!Why This Architecture?
- Zero Hosting: No server or VPS required - Pixlpay handles everything
- Always Online: Discord's infrastructure ensures 100% uptime
- Easy Setup: Just create a Discord application and paste credentials
- Instant Updates: New features are automatically available
- Secure: Your bot token is encrypted and never exposed
Setting Up Discord
Step 1: Create a Discord Application
- Go to Discord Developer Portal
- Click New Application
- Name it (e.g., "My Store Bot")
- Go to Bot section
- Click Add Bot or Reset Token
- Copy the Bot Token (you'll need this later)
Step 2: Invite Bot to Your Server
- Go to OAuth2 > URL Generator
- Select scopes:
botandapplications.commands - Select permissions:
Manage Roles - Copy the generated URL
- Open the URL and select your Discord server
- Authorize the bot
Important
The bot's role must be higher than roles it assigns. Drag the bot's role above other roles in Server Settings > Roles.
Step 3: Configure in Pixlpay
- Go to Settings > Integrations > Discord in your store dashboard
- Scroll to Custom Bot Setup
- Enter your credentials:
- Application ID - From General Information page
- Public Key - From General Information page (64-character hex string)
- Bot Token - From Bot section
- Click Save & Register Commands
Step 4: Set the Interactions Endpoint URL
- In Discord Developer Portal, go to your application's General Information
- Find the Interactions Endpoint URL field
- Enter your store's webhook URL:
https://api.pixlpay.net/webhook/discord/interactions/{your-store-slug} - Click Save Changes
Finding Your URL
The exact URL is shown in your Pixlpay dashboard under Settings > Integrations > Discord > Custom Bot Setup. You can copy it directly from there.
For complete step-by-step instructions, see the Custom Discord Bot Setup Guide.
Configuring Role Delivery
On Products
When creating or editing a product:
- Go to the Delivery tab
- Enable Discord Role
- Select your Discord server
- Choose the role to assign
Multiple Roles
You can assign multiple roles per product:
- Click Add Role
- Select additional roles
- Save the product
Customer Commands
Once configured, customers can use these commands in your Discord server:
| Command | Description |
|---|---|
/claim | Claim all pending role deliveries |
/check | View pending and recent role deliveries |
/help | Show available commands |
Requiring Discord at Checkout
Force customers to connect Discord before purchase:
- Go to Settings > Checkout
- Enable Require Discord
- Customers must authenticate before paying
Subscription Behavior
For subscription products:
- On Purchase - Role is assigned immediately
- On Renewal - Role remains active
- On Cancellation - Role is removed after period ends
- On Expiration - Role is automatically removed
Troubleshooting
Bot Can't Assign Role
- Ensure bot role is higher than target role in Discord
- Check bot has "Manage Roles" permission
- Verify role ID is correct
Customer Not Receiving Role
- Confirm customer authenticated with Discord
- Check if customer is in your Discord server
- Have customer run
/claimin your Discord server - Check the order delivery status in your dashboard
Discord Connection Failed
- Verify Application ID, Public Key, and Bot Token in Pixlpay settings
- Ensure Interactions Endpoint URL is correct in Discord Developer Portal
- Re-save your bot credentials
Commands Not Appearing
- Slash commands can take up to 1 hour to appear globally
- Re-invite the bot with
applications.commandsscope - Click "Re-register Commands" in Pixlpay dashboard
"Member not found in guild"
The customer is not in your Discord server. They need to join before the role can be assigned.
Best Practices
- Unique Bot Name - Give your bot a name related to your store for brand recognition
- Custom Avatar - Upload a logo for your bot in Discord Developer Portal
- Role Hierarchy - Keep your bot's role high but below admin roles
- Monitor Stats - Check the dashboard regularly for errors
- Communicate - Tell customers to use
/claimafter purchase in order confirmation emails
Next Steps
- Custom Discord Bot Setup Guide - Detailed setup instructions
- Troubleshooting Guide - Common issues and solutions
- Game Servers - Deliver to game servers too
