Custom Discord Bot
Set up your own Discord bot for seamless role delivery without hosting any infrastructure.
Overview
The Custom Discord Bot feature allows you to deliver Discord roles to customers without running any server software. Instead of hosting a bot yourself, you create a Discord application and Pixlpay handles all the interaction logic through Discord's HTTP interactions system.
Key Benefits
| Feature | Description |
|---|---|
| Hosting | No hosting required - Pixlpay handles everything |
| Setup Time | ~5 minutes to configure |
| Uptime | 100% uptime via Discord's infrastructure |
| Maintenance | None - updates are automatic |
| Technical Skill | Beginner friendly - just paste credentials |
Why Custom Discord Bot?
- Zero Hosting: The bot logic runs on Pixlpay's servers, triggered by Discord
- Always Online: No need to worry about your bot going offline
- Easy Setup: Just create a Discord application and paste credentials
- Instant Updates: New features are automatically available
- Same Security: Your bot token is encrypted and secure
Prerequisites
Before starting, you will need:
- A Discord account with permission to manage a Discord server
- Access to the Discord Developer Portal
- A Pixlpay store with Discord integration enabled
Step-by-Step Setup
Step 1: Create a Discord Application
- Go to the Discord Developer Portal
- Click New Application (top right)
- Enter a name for your bot (e.g., "My Store Bot")
- Accept the Developer Terms of Service
- Click Create
Step 2: Get Your Application Credentials
From your application's General Information page, you will need two values:
- Application ID - A long number (e.g.,
123456789012345678) - Public Key - A 64-character hexadecimal string
Keep These Safe
Copy both values somewhere safe - you will need them when configuring Pixlpay.
Step 3: Create Your Bot
- Go to Bot in the left sidebar
- Click Add Bot (or Reset Token if already created)
- Click Yes, do it! to confirm
Once created, you need to get your Bot Token:
- Under the bot's username, click Reset Token
- Confirm the action
- Copy the token immediately - it won't be shown again!
Keep Your Token Secret
Your bot token is like a password. Never share it publicly or commit it to version control. If compromised, reset it immediately.
Step 4: Set the Interactions Endpoint URL
This is the crucial step that connects Discord to Pixlpay:
- Go to General Information in your Discord application
- Find the Interactions Endpoint URL field
- Enter your store's webhook URL in this format:
https://api.pixlpay.net/webhook/discord/interactions/{your-store-slug}Replace {your-store-slug} with your actual store slug. For example, if your store is mystore.pixlpay.net, the URL would be:
https://api.pixlpay.net/webhook/discord/interactions/mystore- Click Save Changes
Finding Your Interactions URL
The exact URL is shown in your Pixlpay dashboard under Settings > Integrations > Discord > Custom Bot Setup. You can copy it directly from there.
Discord will immediately verify the endpoint by sending a PING request. If you see an error, make sure:
- The URL is exactly correct (no trailing slashes)
- You have saved your credentials in Pixlpay first (see Step 6)
Step 5: Invite the Bot to Your Server
Your bot needs to be in your Discord server to assign roles:
- Go to OAuth2 > URL Generator in your Discord application
- Under Scopes, select:
botapplications.commands
- Under Bot Permissions, select:
Manage Roles
- Copy the Generated URL at the bottom
- Open the URL in your browser
- Select your Discord server from the dropdown
- Click Authorize
Bot Role Position
After inviting the bot, go to Server Settings > Roles in Discord. Drag your bot's role above all the roles it needs to assign. Bots can only assign roles lower than their own role in the hierarchy.
Step 6: Configure in Pixlpay Dashboard
Now connect everything in your Pixlpay dashboard:
- Go to Settings > Integrations > Discord
- Scroll to Custom Bot Setup
- Enter your credentials:
- Application ID - From Step 2
- Public Key - From Step 2
- Bot Token - From Step 3
- Click Save & Register Commands
Pixlpay will:
- Validate your bot token
- Register the slash commands (
/claim,/check,/help) - Show a success message
Global Commands Take Time
Slash commands are registered globally, which can take up to 1 hour to appear in all servers. For immediate testing, commands appear instantly in the server where you created the bot.
Customer Commands
Once set up, your customers can use these commands in your Discord server:
/claim
Claims all pending role deliveries for the customer.
/claimResponse:
Roles assigned:
- VIP Member
- Premium Access
Your roles have been delivered!/check
Shows pending and recently delivered roles.
/checkResponse:
Pending roles:
- VIP Member
Recently delivered (last 24h):
- Premium Access (2 hours ago)
Use /claim to receive your pending roles!/help
Displays available commands and how to use them.
/helpResponse:
MyStore Bot Commands
/claim - Claim your purchased Discord roles
/check - View pending and recent role deliveries
/help - Show this help message
How it works:
1. Purchase a product with Discord roles on the store
2. Make sure your Discord account is linked on the store
3. Use /claim here to receive your roles
Need help? Contact the store owner for support.How Delivery Works
The Custom Discord Bot uses Discord's HTTP Interactions model - a modern, webhook-based approach:
Customer purchases product with Discord role
|
v
Pixlpay queues role delivery
(stored in discord_delivery_queue)
|
v
Customer runs /claim in Discord
|
v
Discord sends HTTP POST to Pixlpay
(to your Interactions Endpoint URL)
|
v
Pixlpay verifies signature using Public Key
|
v
Pixlpay assigns role using your Bot Token
|
v
Customer receives role instantly!Key Points
- Customer-Initiated: Roles are delivered when customers use
/claim - Instant Response: Discord requires a response within 3 seconds - Pixlpay handles this
- Secure: Every interaction is cryptographically verified using Ed25519 signatures
- Reliable: Discord's infrastructure ensures 100% uptime for command delivery
Dashboard Statistics
Monitor your bot's activity in the Pixlpay dashboard:
| Statistic | Description |
|---|---|
| Total Interactions | All commands processed |
| Roles Assigned | Successfully delivered roles |
| Roles Removed | Roles removed (refunds, subscription cancellations) |
| Errors | Failed operations (permission issues, etc.) |
| Success Rate | Percentage of successful operations |
| Last Interaction | When the bot last processed a command |
Troubleshooting
"This server is not connected to any store"
The Discord server isn't linked to your Pixlpay store.
Solution: Use the internal Pixlpay bot's /verify command to connect the server:
- Invite the Pixlpay verification bot to your server
- Run
/verify {code}with your store's verification code - Try
/claimagain
"You don't have any pending role deliveries"
The customer doesn't have any roles waiting to be claimed.
Possible causes:
- Customer hasn't linked their Discord account on your store
- Customer hasn't completed a purchase with Discord roles
- Roles were already delivered
Solution: Have the customer:
- Log in to their account on your store
- Link their Discord account in account settings
- Check their order includes Discord role delivery
Discord shows "Interaction failed"
The interaction endpoint couldn't respond in time or returned an error.
Possible causes:
- Incorrect Interactions Endpoint URL
- Bot credentials not configured in Pixlpay
- Bot is disabled in Pixlpay
Solution:
- Verify the Interactions Endpoint URL is exactly correct
- Check bot is enabled in Settings > Integrations > Discord
- Re-save your bot credentials
Bot can't assign a role
The role assignment fails even though the command works.
Possible causes:
- Bot role is lower than the target role
- Bot doesn't have "Manage Roles" permission
- Role is managed by an integration (e.g., Nitro Booster)
Solution:
- Go to Server Settings > Roles in Discord
- Drag your bot's role above the roles it needs to assign
- Check the bot has "Manage Roles" permission
- Ensure target roles aren't integration-managed
Commands not appearing in Discord
Slash commands don't show up when typing /.
Possible causes:
- Commands were just registered (can take up to 1 hour)
- Bot isn't in the server
applications.commandsscope wasn't selected when inviting
Solution:
- Wait up to 1 hour for global command propagation
- Re-invite the bot with both
botandapplications.commandsscopes - Click "Re-register Commands" in Pixlpay dashboard
"Invalid signature" errors in logs
Discord signature verification is failing.
Possible causes:
- Incorrect Public Key entered in Pixlpay
- Public Key was regenerated in Discord
Solution:
- Go to Discord Developer Portal > General Information
- Copy the current Public Key
- Update it in Pixlpay dashboard
- Save changes
Security Notes
Why Custom Bot is Safe
The Custom Discord Bot approach maintains liability compliance through delegation:
- Store Owner Ownership: You create and own the Discord application
- Delegated Authority: You authorize Pixlpay to act on your behalf using your credentials
- Revocable Access: You can reset your bot token anytime to revoke access
- Same as Stripe: Similar to how you connect your Stripe account - you remain the owner
Token Security
Your bot token is protected:
- Encrypted at rest using Laravel's encryption
- Never exposed in API responses after saving
- Never logged or stored in plaintext
- Transmitted only over HTTPS
Interaction Verification
Every Discord interaction is verified:
- Discord signs each request with Ed25519
- Pixlpay verifies using your Public Key
- Invalid signatures are rejected immediately
- Prevents spoofed or tampered requests
Best Practices
- Unique Bot Name: Give your bot a name related to your store for brand recognition
- Custom Avatar: Upload a logo or avatar for your bot in Discord Developer Portal
- Role Hierarchy: Keep your bot's role high in the hierarchy but below admin roles
- Monitor Stats: Check the dashboard regularly for errors or unusual activity
- Communicate: Tell customers to use
/claimafter purchase - add it to your order confirmation emails
Next Steps
- Discord Integration Overview - General Discord integration guide
- Products - Configure products with Discord roles
- Webhooks - Get notified when roles are delivered
