A storefront website that sells Free Fire diamonds, Free Fire memberships, PUBG Mobile UC and Roblox Robux. Customers pick a package, enter their player ID (or Roblox username), pay by mobile money, and paste the transaction reference. You confirm the payment and mark the order delivered from a built-in admin dashboard.
Rendering mermaid diagram...
The customer tracks their order in the My order tab by typing the order ID (YG-XXXXXX); the
status refreshes automatically every few seconds.
The dashboard lives at #admin and is protected by an env var, so nobody else can
confirm orders on your behalf. There is no default ā the admin API stays locked until you set one.
š Add ADMIN_PASSWORD here: https://www.val.town/x/yared/game-topup-store/environment-variables?key=ADMIN_PASSWORD
Sign in at /#admin ā settings and fill in:
| Field | What it's for |
|---|---|
telebirrNumber | Where customers send Telebirr payments |
cbeAccount | Your CBE Birr account |
mpessaNumber | Your M-Pesa number |
supportTelegram | Shown as a "Support" link in the header |
supportPhone | Shown in the footer |
notice | A banner across the top (e.g. a holiday message) |
instructions | The paragraph shown in the payment step |
Nothing is shown to customers until you set it ā an empty method shows "isn't set up yet" and points them at support instead.
The catalogue ships with placeholder ETB prices. Edit them in settings ā products: type a new price straight into the table (it saves when you click away), hide a package from the shop with the visible/hidden toggle, or add and delete packages freely.
Prices also live in db.ts as the seed list ā that only runs on an empty database, so
after first boot the dashboard is the source of truth.
Roblox doesn't let you push Robux into another player's balance, so Robux is the one product that needs a delivery plan. Two routes work:
- Roblox gift card code ā buy the code and send it to the customer, who redeems it for Robux. Simplest, and the usual route outside Roblox's own billing countries.
- Their game pass / developer product ā the customer lists a pass at the Robux price and you buy it, which pays the Robux out to them.
Either way you collect a username, not an ID. The checkout form switches automatically: the
Roblox game entry in frontend/components/types.ts carries its
own label, placeholder, hint and keypad (Roblox username, no numeric keypad), and the order
receipt, admin row and Roblox tile all follow it. Add Robux packages from settings ā products
with the game set to Roblox ā the category defaults to robux for you.
Set TELEGRAM_TOKEN (from @BotFather) and TELEGRAM_CHAT_ID (your own
chat id) and every new order pings you on Telegram ā handy if you also run
free-fire-diamond-bot. Leave them unset and
nothing breaks; the admin dashboard still shows every order.
š Add TELEGRAM_TOKEN here: https://www.val.town/x/yared/game-topup-store/environment-variables?key=TELEGRAM_TOKEN
š Add TELEGRAM_CHAT_ID here: https://www.val.town/x/yared/game-topup-store/environment-variables?key=TELEGRAM_CHAT_ID
index.ts Hono server ā routes for the shop, orders and admin
db.ts SQLite schema, seed catalogue, queries
telegram.ts Optional new-order notifications
frontend/
root.tsx HTML shell (stamps immutable asset URLs)
index.tsx React entrypoint
components/
App.tsx Layout, tabs, game/category filters
ProductCard.tsx One package tile
CheckoutDialog.tsx Account ID / username + payment form
OrderTracker.tsx Order receipt and "My order" lookup
AdminPanel.tsx Orders, products and settings dashboard
api.ts / types.ts API client and shared types
| Route | Purpose |
|---|---|
GET /api/store | Public catalogue + store settings |
POST /api/orders | Place an order |
GET /api/orders/:id | Look up an order by its public ID |
GET /api/admin/overview | All orders, products, stats and settings |
POST /api/admin/orders/:id | Set an order's status |
POST /api/admin/products | Create or update a package |
DELETE /api/admin/products/:id | Remove a package |
POST /api/admin/settings | Save payment numbers and copy |
Everything under /api/admin/* needs an x-admin-key header matching ADMIN_PASSWORD.
Two rails, either or both:
Manual mobile money ā the customer pays your Telebirr / CBE Birr / M-Pesa number, types the SMS reference, and you approve the order from the dashboard. Works with no gateway account.
Chapa (card, Telebirr, mobile money) ā the customer is sent to Chapa's hosted checkout and comes back to the receipt. The order confirms itself; you only do the in-game top-up.
To turn Chapa on you need a merchant account at https://dashboard.chapa.global and two secrets:
š Add CHAPA_SECRET_KEY here: https://www.val.town/x/yared/game-topup-store/environment-variables?key=CHAPA_SECRET_KEY
š Add CHAPA_WEBHOOK_SECRET here: https://www.val.town/x/yared/game-topup-store/environment-variables?key=CHAPA_WEBHOOK_SECRET
Then set chapaEnabled to 1 in admin ā settings. Register this webhook URL in your Chapa
dashboard so payments confirm even if the customer closes the tab:
https://yared-game-store.val.run/api/payments/chapa/webhook
CHAPA_API_VERSION defaults to v1 (api.chapa.co); set it to v2 if your keys are for
api.chapa.global. Start in test mode.
Rendering mermaid diagram...
The redirect and the webhook are treated as hints only ā every path funnels through a
server-side verify call before an order is marked paid, and the amount is checked against the
package price so an underpayment can't release the goods. Webhooks are authenticated with
HMAC-SHA256 over the raw request body (x-chapa-signature) and compared in constant time; forged
requests get a 401.
Every product has a cost alongside its price ā what you pay for it. Enter costs on the products tab and the dashboard shows profit, not just turnover.
Two deliberate choices make those numbers trustworthy:
- Cost is snapshotted onto each order when it's placed, so repricing later never rewrites the margin on past orders.
- Profit only counts orders with a cost recorded. An unknown cost contributes zero rather than reading as 100% margin, and the dashboard says how many delivered orders are being left out.
products tab ā Cost column (type, press Enter) ā Margin column goes green/red
dashboard ā Profit stat beside Revenue
each order ā a Margin line when a cost was known
- Nothing here is affiliated with Garena, Tencent or Roblox.
- Order IDs are random (
YG-+ 6 characters), so a customer can only see their own order. - The player ID (or Roblox username) is typed by the customer ā always double-check it before topping up, because in-game top-ups can't be reversed.
- Roblox players are identified by username, which is case-insensitive and can be changed ā if a name doesn't resolve, ask the customer for their user ID instead.