Tebex Webhooks Explained: Automating Discord Roles & In-Game Delivery After Purchase
# Tebex Webhooks Explained: Automating Discord Roles & In-Game Delivery After Purchase
The moment a customer completes a purchase is the moment their excitement peaks, and it's exactly when a slow or manual delivery process does the most damage to their impression of your server. Tebex webhooks let you eliminate that gap entirely, triggering automated actions the instant a payment is confirmed.
At **Code X Art Studios**, every store we build wires webhooks directly into the server's own backend rather than relying on Tebex's default in-game command delivery alone. ## 1. How Tebex Webhooks Work
When a payment completes, Tebex sends a signed HTTP POST request to a URL you configure, containing the transaction details, packages purchased, and the buyer's identity. Your own server verifies the signature (using your webhook secret) and reacts accordingly, this is the same mechanism many payment platforms use, applied to game store purchases.
// Example: verifying a Tebex webhook signature before processing it
import crypto from 'crypto';export function verifyTebexWebhook(rawBody: string, signature: string, secret: string): boolean { const expected = crypto.createHmac('sha256', secret).update(rawBody).digest('hex'); return crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(signature)); } ``` ## 2. Automating Discord Role Assignment
Once a webhook confirms a purchase, your backend can immediately call the Discord API to grant the buyer a VIP role, no waiting for a staff member to manually check payment logs. This alone dramatically improves the perceived professionalism of a store. ## 3. Instant In-Game Delivery
Rather than relying solely on Tebex's native in-game command execution (which requires the player to be online), a webhook can write the purchase directly to your database, so the item, vehicle, or rank is granted the next time the player connects, regardless of whether they were online at checkout. ## 4. Handling Failed or Disputed Payments
Tebex also sends webhook events for refunds and chargebacks, configuring your backend to automatically revoke Discord roles and in-game items on these events (rather than manually tracking disputes) keeps your economy consistent and reduces staff workload. Want your store's purchase flow fully automated end-to-end? Our team builds custom Tebex webhook integrations as part of every e-commerce project, explore our [e-commerce services](/services) or reach out via [Contact](/contact).
