Skip to content
VPNDetection

Prevent free-trial abuse

Limit how many free trials one network can start, using the network VPNDetection returns for each sign-up, so one person can't open dozens.

Someone who wants an endless free trial creates a new account each time it ends. They change their email address every time, but they rarely change their network. Counting trials per network catches this without adding friction for anyone else.

How it works

For each trial sign-up, your server looks up the address and records the network it belongs to. Before it starts a new trial, it counts how many trials that network has started recently, and asks for a payment method when the count passes a limit you set.

Before you begin

  • A table where you can record each trial's network and start date.

1. Decide whether a trial may start

Key each trial by the free plan's asn.prefix, the block of addresses the network announces, such as a home internet provider's or a datacenter's. Then compare the number of recent trials from that block with a limit that fits the network:

Node.js
export async function canStartTrial(ip) {
    const r = await client.lookup(ip);
    // An address that no network announces has an empty prefix, so it counts on its own.
    const network = r.asn?.prefix || ip;
    const recent = await db.countTrials({ network: network, sinceDays: 30 });
    const limit = r.isVpn || r.isTor || r.asn?.type === 'hosting' ? 2 : 50;
    return { network: network, allowed: recent < limit };
}

Many real customers share a home or mobile provider's block, so the limit for those networks is generous. Hosting networks, VPNs and Tor get a low one. Tune both numbers to your traffic: start generous, and lower them as you learn what normal looks like.

2. Record each trial

When a trial starts, store its network and start date with the account, so the next count includes it.

3. Tell the person what's happening

When a trial isn't allowed, ask for a payment method instead of refusing outright. A message such as "Many trials have started from your network. Add a payment method to start yours." keeps a genuine customer, and makes abuse at scale too slow to be worth it.

4. Account for shared networks

Some networks put many customers behind a few addresses. Mobile carriers share addresses between many phones, and universities and large offices route everyone through one block. A limit tuned for a home provider can catch them all.

  • Keep the limit for isp networks generous, and lower it only when your data shows abuse from a specific block.
  • Exempt networks you know, such as a business customer's office, by their asn.prefix.
  • When a limit trips, offer a path that still converts: ask for a payment method, not a refusal.

5. Handle a failed lookup

If the lookup fails, start the trial and key it by the address itself, the same fallback the code uses for an unannounced address. Refusing a trial because a lookup failed costs a real customer.

6. Test it

Connect to a VPN and start trials from the same server until you reach the limit for VPNs. The next trial should ask for a payment method. A trial from your home connection should still start.

With a paid plan

  • vpn.provider names the VPN service, so a limit can follow the provider instead of an exit address that rotates.
  • is_resproxy and resproxy.hits flag trials from rented home connections, which abusers often move to once datacenters are blocked.

Next steps

To screen every sign-up, not only trials, see Screen VPN and proxy sign-ups.