What premium covers
- Bot premium tiers
- Server premium tiers
- Weekly, monthly, and lifetime durations
- Gifted purchases
- Order history and transaction tracking
- Premium lifecycle webhooks for purchases, renewals, expirations, and revocations
How a purchase works
1
Choose a target
Premium can be attached to a bot or a server, depending on what the product offers.
2
Choose a tier
Tiers define the price, duration, and plan type that will be charged.
3
Confirm the credit balance
Rankly checks the purchaser’s available credits before the order is created.
4
Store the resulting state
Keep your own internal record of the plan, the expiry, and whether the purchase was gifted.
Premium webhooks
For bot premium plans, Rankly sends signed webhook events to your configured premium webhook URL.Headers
X-Webhook-Signature: HMAC SHA-256 signature of the exact JSON bodyContent-Type:application/json
Signature verification (Node.js)
Plan types
Event types you can receive
Webhook payload examples
premium_purchase
subscription.renewed
subscription.expired
subscription.revoked
What could happen in production
- A user buys premium now: you get
premium_purchase, then grant features immediately. - The subscription renews a month later: you get
subscription.renewed, and just extend access. - Auto-renew fails: you get
subscription.expired, and you should remove paid features. - A chargeback happens after purchase: you get
subscription.revoked, and you should disable access right away. - A gift purchase is made:
isGiftis true andrecipientis populated, so entitlement should be applied to the recipient.
What to expect in your app
- A premium purchase becomes an order in Rankly’s billing flow.
- The purchaser and recipient can be different users when the plan is gifted.
- The dashboard should always show the current status, not just the original purchase date.
- If you need to reflect the current plan in your bot, refresh your own cached state after checkout.
Handler checklist
- Verify
X-Webhook-Signaturebefore processing. - Deduplicate by
orderIdplusevent. - Make state transitions idempotent.
- Treat
subscription.revokedas highest priority for entitlement removal. - Return
2xxquickly, then do heavy work async.
Helpful implementation notes
- Keep tier IDs stable once users rely on them.
- Show the user what they are paying for before they confirm the purchase.
- Make expired plans obvious in the UI.
- Treat a billing failure as a recoverable state, not a fatal error.
Related docs
Credits
See how premium purchases interact with balances.
Bot API Integration
Pull plan state into your bot commands or dashboard.