Anyone can write a script that picks random numbers. A lottery platform you can run as a business needs more than that: prize tiers that are funded, draws you can explain, a plan for slow sales, and a record of everything. This guide is about those parts. It uses RaffKing, our self-hosted lottery and raffle script, for concrete examples, and it's honest about the gaps.

Running a lottery for money is regulated almost everywhere, and in many places it's reserved for state or licensed operators. Licensing is your responsibility. Nothing here is legal advice: check with a local lawyer before you sell a ticket, and never market a paid draw to anyone under 18.

Number-match draws vs ticket raffles

There are two common designs:

The rest of this article is about number-match draws, because that's where the maths can surprise you.

The odds, and why they decide your prize tiers

The chance of matching depends on how many numbers each ticket has. Here are the exact odds for a ticket of 3, 5 or 6 numbers drawn from 1–49:

Numbers per ticketMatch allMatch all but oneMatch all but two
3 of 491 in 18,4241 in 133.5 (2 of 3)1 in 5.9 (1 of 3)
5 of 491 in 1,906,8841 in 8,668 (4 of 5)1 in 202 (3 of 5)
6 of 491 in 13,983,8161 in 54,201 (5 of 6)1 in 1,032 (4 of 6)

Two things follow for a small operator:

Check the expected payout before you publish

For each tier, multiply the chance by the prize and add them up. That gives the average paid out per ticket. Here's an illustrative example (not a recommendation) for a 3-of-49 ticket costing 100 coins, with prizes of 50,000 coins for 3 matches and 500 coins for 2:

50,000 ÷ 18,424 + 500 × 138 ÷ 18,424 ≈ 6.5 coins per ticket

On average that pays back about 6.5% of ticket revenue as prizes. That's very little, and many regulators set a minimum share that must go to prizes or good causes. Decide the payout you intend, check it against your licence conditions, and set the tiers to match. Never advertise a prize level you haven't funded.

Draws: verified, automatic or manual

Only verified draws can be checked by players themselves. Whichever you use, what also protects players is publishing results, keeping the admin log, and locking settings once money is taken. RaffKing locks the type and ticket settings once tickets are sold, and the draw method and prizes once winners are declared.

Slow sales: auto-extend

Draw times arrive whether or not tickets have sold. With Verified draws off, RaffKing can move a draw back by itself if sales are below a minimum: after N hours, up to M times. After that it either keeps extending or waits for you to draw by hand. State this rule in your terms so players know a draw can move. With Verified draws on, auto-extend never moves a draw's end, because the UK's DCMS code for prize draws (2.5) asks operators not to move a draw because of low sales. Before a verified draw closes, the store can convert it to an ordinary draw, publicly marked "Not verified", or cancel it and refund every ticket in full.

What players see

Payments by market

Players buy tickets with wallet coins, which they top up through your payment gateways. RaffKing includes 11 gateways (Stripe, PayPal, Razorpay, PayU, 2Checkout, Authorize.net, Checkout.com, Mollie, GoCardless, Cashfree, Instamojo), plus a manual method for bank transfer or local QR payments. Regional gateways such as Paystack, Flutterwave, M-Pesa and Mercado Pago are separate add-ons, available from Add-ons in your admin panel.

The harder question is whether a processor will accept a lottery business at all. Many restrict games of chance, so read the acceptable-use policy and expect to show your licence.

Licensing

Who can run a lottery, and under what licence, differs by country and sometimes by region within a country. Official starting points include the UK Gambling Commission, the UAE's GCGRA and the Philippines' PAGCOR. In India, the Promotion and Regulation of Online Gaming Act, 2025 bans online money games. For anywhere, check with a local lawyer. Our online lottery business guide covers what to ask.

Buyer's checklist

Common questions

What are the odds of matching 6 numbers from 49?

1 in 13,983,816 for a ticket of 6 numbers. Matching 5 of 6 is about 1 in 54,201, and 4 of 6 about 1 in 1,032.

Can more than one ticket win the same prize?

Yes. In RaffKing, every ticket whose number of matches falls in a prize's range wins that prize, so budget for several winners in a tier.

How are lottery numbers drawn in RaffKing?

On a new store, Verified draws are on: each draw is committed to a secret seed when it's made, and its numbers come from that seed and public drand randomness published after the close, so anyone can check them on the draw's Verify page. With Verified draws off, automatic draws use PHP's random_int() at the draw time, and manual draws let you enter numbers from an independent source, with every change logged.

Do I need a licence to run an online lottery?

Almost certainly, and in many countries private lotteries aren't allowed at all. Check with a local lawyer before you launch.

RaffKing — self-hosted lottery & raffle script Number-match and raffle draws, prize tiers by matches, publicly verifiable draws, a live ticket feed and 11 payment gateways. One-time licence.