How to create MikroTik hotspot vouchers, from setup to vouchers ready to sell
A hotspot voucher is a Wi-Fi login code sold by the hour, day, or data quota. This guide covers two ways: creating vouchers directly on MikroTik, and creating them through RADIUS so validity, printing, and sales run automatically.
Updated ยท 4 min read
Hotspot setup
Enable Hotspot on the customer Wi-Fi or LAN interface.
User profile
Set speed and devices per voucher.
Bulk generation
Create dozens to thousands of codes at once.
Sell & print
Print on A4/thermal paper or sell through an online store.
Contents
What you need
- A MikroTik router on RouterOS v6 or v7 connected to the internet.
- An interface for hotspot users, such as wlan1, a Wi-Fi bridge, or a port to an access point.
- The plans you want to sell, for example 3 hours, 1 day, and 7 days.
1. Enable Hotspot on MikroTik
In Winbox open IP > Hotspot > Hotspot Setup, choose the customer interface, and follow the wizard (network address, IP pool, DNS, and login page DNS name). From the terminal, run the same wizard with:
/ip hotspot setup2. Create a user profile per plan
A user profile sets the speed (rate-limit) and how many devices may share one voucher (shared-users). Create one profile per plan:
/ip hotspot user profile add name=3h rate-limit=2M/2M shared-users=1
/ip hotspot user profile add name=1d rate-limit=3M/3M shared-users=1
/ip hotspot user profile add name=7d rate-limit=5M/5M shared-users=23. Create a voucher (hotspot user)
One voucher is one hotspot user. Use the same username and password so buyers type a single code. limit-uptime caps total online time:
/ip hotspot user add name=k4m9ra password=k4m9ra profile=3h limit-uptime=3h4. Generate many vouchers at once
Typing them one by one is impractical. On RouterOS v7, this script creates 50 random 6-character vouchers for the 3h profile. Look-alike characters (0/o, 1/l/i) are left out to avoid typos:
RouterOS v6 has no :rndstr, so bulk generation there usually relies on add-on tools such as Mikhmon or User Manager.
:for i from=1 to=50 do={
:local c [:rndstr from="abcdefghjkmnpqrstuvwxyz23456789" length=6]
/ip hotspot user add name=$c password=$c profile=3h limit-uptime=3h comment="batch-3h"
}5. Test a voucher login
- Connect a phone to the hotspot Wi-Fi. The login page opens automatically, or open the DNS name set during setup.
- Enter the voucher code as username and password.
- Check IP > Hotspot > Active: the voucher appears with its uptime and device MAC address.
- If it fails, check the Log.
invalid username or passwordmeans a wrong code,no more sessions are allowedmeans shared-users is full.
Drawbacks of vouchers stored on the router
limit-uptimecounts online time, not calendar validity. A 1-day voucher used 2 hours a day can last almost two weeks. Limiting validity from first login needs extra on-login scripts and a scheduler.- Vouchers live on one router. With several hotspot sites, vouchers must be copied to each router and cannot be used across locations.
- No sales records: how many vouchers were sold, by which reseller, and how much was paid must be tracked separately.
- A router reset or deleted configuration wipes all unused vouchers.
The automatic way: hotspot vouchers through RADIUS
With RADIUS, vouchers are stored on the server, not the router. Point MikroTik to RADIUS once (use-radius=yes in the Hotspot profile) and every hotspot site uses the same voucher data. Validity counts from first login, and expired vouchers are rejected by RADIUS without any router scripts.
Connecting the router is covered in the MikroTik RADIUS setup article.
Creating hotspot vouchers in MaxRadius
Each batch's stock (unused, active, expired) is shown in the Voucher menu, and unused vouchers can be disabled or deleted in bulk. To sell through resellers with wallet balances and commissions, see the hotspot voucher and reseller article.
- Create a hotspot-type product in the Paket (Plans) menu: speed, price, shared users, and validity in minutes, hours, days, weeks, or months. Optionally add a usage-time or data-quota limit.
- Open the Voucher menu, click Generate voucher, and pick the product and quantity (up to 2,000 per batch).
- Choose the login method (code only or username + password), character set, code length, and prefix. Enable Ikat ke MAC pertama (Bind to first MAC) if one voucher should work on one device only.
- Print with Template cetak (Print templates) for A4 or 58/80 mm thermal printers, including a QR code, or download a PDF and share it on WhatsApp.
- Tick Dijual di toko eVoucher (Sold in eVoucher store) on the product so buyers can purchase on your portal's /voucher page and receive the code right after paying by QRIS.
Frequently asked questions
What is the difference between limit-uptime and voucher validity?
limit-uptime counts total online time and pauses when the user is offline. Validity counts calendar time from first login, so a 1-day voucher ends 24 hours later even if not used continuously.
How do I limit one voucher to one device?
Set shared-users=1 in the user profile. In MaxRadius, also enable Bind to first MAC so the voucher locks to the first device that logs in.
Do I need Mikhmon to create vouchers?
No. On RouterOS v7, bulk vouchers can be created with the script above. With RADIUS such as MaxRadius, generating, printing, and selling happen from the web panel without extra apps.
Can a voucher be used on several routers?
A router-stored voucher only works on the router where it was created. A RADIUS voucher works on every router connected to the same RADIUS.