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
Confirm the credit balance
Rankly checks the purchaser’s available credits before the order is created.
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
| Plan type | Meaning |
|---|---|
| Weekly | Renew or expire on a 7-day cycle. |
| Monthly | Renew or expire on a 30-day cycle. |
| Lifetime | Stays active until it is manually revoked. |
Event types you can receive
| Event | Meaning | Common reason |
|---|---|---|
premium_purchase | A premium order was created successfully. | New checkout completed |
subscription.renewed | A recurring plan was renewed. | Auto-renew succeeded |
subscription.expired | A recurring plan was ended. | Past due, invalid buyer, tier unavailable |
subscription.revoked | A plan was revoked and should be disabled immediately. | Chargeback/dispute |
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.