Public
Storefront for Free Fire diamonds, PUBG UC & Roblox Robux
ecommercesqliteroblox
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.

Yared Game Store

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.

Open the store

How an order flows

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.

Setting it up

1. Set your admin password

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

2. Fill in your payment numbers

Sign in at /#admin → settings and fill in:

FieldWhat it's for
telebirrNumberWhere customers send Telebirr payments
cbeAccountYour CBE Birr account
mpessaNumberYour M-Pesa number
supportTelegramShown as a "Support" link in the header
supportPhoneShown in the footer
noticeA banner across the top (e.g. a holiday message)
instructionsThe 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.

3. Fix the prices

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.

4. Roblox: decide how you'll deliver Robux first

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.

Optional: Telegram alerts

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

What's in the box

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

API

RoutePurpose
GET /api/storePublic catalogue + store settings
POST /api/ordersPlace an order
GET /api/orders/:idLook up an order by its public ID
GET /api/admin/overviewAll orders, products, stats and settings
POST /api/admin/orders/:idSet an order's status
POST /api/admin/productsCreate or update a package
DELETE /api/admin/products/:idRemove a package
POST /api/admin/settingsSave payment numbers and copy

Everything under /api/admin/* needs an x-admin-key header matching ADMIN_PASSWORD.

Payments

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.

How confirmation works

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.

Tracking your margin

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

Notes

  • 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.