03/09 — Case study
Profitex Subscription Bot
Automated paid-membership bot for a forex trading academy
Runs the whole paid-membership lifecycle for Profitable Forex Trading Academy's private Telegram community: payment, a single-use invite link, renewal reminders, and automatic removal when a subscription lapses.
- Role
- Sole engineer
- Type
- Telegram bot · Payments
- Year
- 2026
- Stack
- TypeScriptNode.jsgrammYMongoDBExpressPaystackFlutterwaveVercel

- payment gateways
- 2
- renewal reminders
- 3
- single-use invite links
- 60 min
Overview
Profitex sells access to a private Telegram community for its forex trading academy. A member picks a plan inside the bot, pays by card, bank transfer or USSD through Paystack or Flutterwave, and receives a private invite link the moment the payment is verified.
From there the bot tracks every subscription: it reminds members before they expire, extends access when they renew early, and removes them automatically when they lapse. The academy's team runs everything (plans, members, broadcasts and manual grants) from an admin menu inside Telegram, with no web dashboard.
Engineering highlights
- 01Every payment is confirmed by calling the gateway's API directly, never by trusting a redirect, a webhook body or a screenshot.
- 02Exactly-once fulfilment: retried webhooks, refreshed redirects and the "I have paid" button share one code path guarded by database-level locks, so a payment can only ever create one subscription.
- 03Signed webhooks from both gateways: HMAC-SHA512 for Paystack and verif-hash for Flutterwave.
- 04Single-use invite links (one member, 60-minute expiry), revoked as soon as a newer one is issued.
- 05Early renewals extend the end date instead of restarting it, and reset the reminder schedule.
- 06Reminders at 7 days, 3 days and 24 hours that land correctly even on a once-a-day cron, with time-budgeted, resumable passes that chain into fresh invocations when there's a backlog.
- 07Recovery for payments whose webhook never arrives, and a free-month trial for members of a partner community.
- 08Telegram admin console with member lists, payment history, plan management, throttled broadcasts and manual grant/revoke, covered by a smoke test and a full lifecycle integration test against an in-memory MongoDB.
Next project
Primetrex Affiliate System
Affiliate platform for a copy trading service