A mystery box script sells a box at a fixed price. Each opening gives the buyer one prize, picked at random by odds you set. Plenty of scripts can spin an animation and hand out a prize. Fewer get the odds, the money and the delivery right. This checklist covers what to look for before you buy one, with PrizeX as the worked example.
1. Weighted prizes and published odds
Every prize needs a weight, and its chance should be its weight divided by the total of all the weights. Check two things:
- Where the random pick comes from. It should use a cryptographically secure generator, not a predictable one. PrizeX picks with PHP's
random_int(). - Where the odds are published. They belong on the box page, before purchase, as a percentage for every prize. Vague rarity words are not enough.
In PrizeX every box page has an odds board listing each prize and its chance, calculated from the same weights the draw uses. Our guide to setting and publishing mystery box odds explains the maths.
2. Odds that lock after the first opening
If an admin can quietly change the odds after people have bought, the published odds mean nothing. Look for a script that stops this.
- In PrizeX, once a box has been opened, its price and each prize's type, chance and value are locked, and no new prize can be added.
3. A price check before you go live
A box loses money if the average prize per opening, at your cost, is more than its price. A good admin form shows you this before you publish. PrizeX's prize form calculates the average prize per opening as you type, and warns you if the box would lose money at its price.
4. 24-hour opening limits
Limits protect customers from chasing losses, and they protect you from free boxes being farmed.
- In PrizeX you can set how many times one person may open each box in 24 hours.
- A free box is always limited, to once every 24 hours unless you set it higher.
- The limit is checked again when the box is opened, so two quick taps can't get past it.
5. Prize types: physical, coins, digital and coupons
A useful script lets one box mix prize types. PrizeX supports four:
- Physical items, shipped to the customer.
- Coins, credited to the customer's wallet when they claim. They can be spent in your store but not withdrawn, unless you turn on Allow cash-out of game winnings under Settings › Wallet.
- Digital items, delivered as a download.
- Coupons, delivered as a code.
Boxes are bought with the wallet balance, so the price and any coin prizes are in the same unit.
6. Claiming and shipping
Winning is only half the job. The customer has to receive the prize, and you need a record of it.
- Claiming: in PrizeX, wins appear under the customer's winnings, and they claim each one from there.
- Physical prizes: the customer picks one of their saved addresses, and the claim becomes an order you fulfil from the admin.
- Your record: every opening is listed under Mystery Boxes › Spins, so you can answer "did I really win that?" with data.
7. Legal framing
Paid random prizes are regulated differently around the world. Some regulators treat them as gambling or as loot boxes, especially when prizes can be turned back into money. That matters here, because PrizeX also includes wallet withdrawals. Coin prizes can't be withdrawn unless you turn on Allow cash-out of game winnings, so ask your lawyer about that combination before you switch it on.
- Licensing: you, as the operator, are responsible for any licence and consumer rules that apply.
- Age: Sign-up asks for a date of birth and checks it against the minimum age set under Settings › Sign-up & compliance; it's at least 18 while auctions, prize draws, mystery boxes or games are on; raise it if your local rules require. Don't sell paid boxes to minors.
- Marketing: don't present a box as a way to make money.
- Before launch: check with a local lawyer.
Checklist
- A secure random pick, with weights you control.
- Odds shown as a percentage for every prize, on the box page, before purchase.
- Odds locked once a box has been opened.
- A loss warning when the average prize costs more than the box price.
- A per-person opening limit (per 24 hours), with free boxes always limited.
- Physical, coin, digital and coupon prizes.
- Claiming from the customer's account, with shipping orders for physical prizes.
- A full log of every opening.
- Self-hosted, so the data and the money are under your control.
Common questions
What should a mystery box script include?
Weighted prizes picked by a secure random generator, odds published on every box page, odds that can't change after the first opening, 24-hour opening limits, several prize types, and a claim and shipping flow with a log of every opening.
Can I change a box's odds after it goes live in PrizeX?
Not once anyone has opened it. Chances and values are locked.
How do customers receive physical prizes?
They claim the win from their account and choose a saved address, and the claim becomes a shipping order in your admin.
Are mystery boxes legal?
It depends on where you sell, what the prizes are, and whether they can be exchanged for money. The operator is responsible for licensing, so check with a local lawyer before selling paid boxes.