MCRX Store Open in Telegram

Documentation

API reference and operating rules for this shop. Every number below describes actual behaviour.

1. Authentication

X-API-Key: mcrx_...

2. Endpoints

GET /sale/count — stock available

FieldTypeDescription
dayintDay bucket (section 3). Default 0.
GET /sale/count?day=7 {"ok":true,"data":{"sum":92}}

POST /sale/claim — buy

Delivers the goods and charges the wallet. All or nothing: if stock is short, nothing is charged and the response is 409.

FieldTypeRequiredDescription
quantityintyes1 to 10000.
dayintnoDay bucket, default 0.
order_refstringnoYour order id. Repeating the same value is treated as the same order and never charges twice.
buyer_refstringnoYour own customer label.
check_2fa, cookieintno1 to include 2FA/cookie in the result.
POST /sale/claim Content-Type: application/json {"quantity":2,"day":0,"order_ref":"BUY-001","buyer_ref":"customer-01"} {"ok":true,"data":{ "batch_id":"3f2c...","order_ref":"BUY-001", "requested":2,"delivered":2, "products":[{"product":"user1|pass1|..."},{"product":"user2|pass2|..."}] }}

POST /sale/release — return goods

Puts claimed goods back for an order. The shop calls it automatically when a delivery comes up short; use it only if you cancel an order yourself.

POST /sale/release {"order_ref":"BUY-001"} {"ok":true,"data":{"released":2}}

GET /orders/{ref}/download

Web session only (cookie), not an API key. Only the buyer or the owning client can download; anybody else gets 404.

Error codes

CodeMeaning
400Bad parameters (quantity out of range, malformed JSON, invalid discount code).
401 / 403Missing or invalid key; also unverified email or locked account.
402Wallet balance too low. Nothing charged.
409Not enough stock. Nothing charged.
502Sales service unavailable; any charge is refunded.

3. Day buckets — exact

Buckets never overlap and cover all time. Dates are in Asia/Ho_Chi_Minh.

dayActual rangeRead as
06 days ago → todaylast 7 days, today included
1todaytoday only
720 → 7 days ago7 to 20 days old
2029 → 21 days ago21 to 29 days old, not "20"
3030 days ago and earlier30 days or older
any other Nexactly day None single day

Verified on sample data: day 0/1/7/20/30 returned 58/4/92/60/88 from the API, identical to direct database counts.

4. Product types

KindGoods come fromWho supplies them
x_accountsX account pool, filtered by day bucketAccounts registered by the system
stock_itemshop.product_stock, one row per unitYou paste them in the panel → Stock

Manual stock (gmail, outlook, software keys…)

Images and unit description

5. Discount codes

Entered next to the Buy button. Checked in order; failing any step charges nothing:

  1. The code exists
  2. It is enabled
  3. It has not expired
  4. The order meets its minimum value
  5. It has uses left
  6. The discount is smaller than the order (a code that zeroes the order is refused)

percent applies a percentage (floored to the cent); fixed subtracts a set amount. A use is recorded only after the order completes, so a failed purchase never burns a use. Managed in panel → Discount codes.

6. Email

7. Panel map

PageWhat it is for
Overview"Needs attention": charged-but-undelivered orders, stale top-ups, ledger drift, low stock
ProductsCreate/edit/delete, day bucket, image, unit description, on/off
StockFilter by product with exact counts, bulk import, void unsold rows, paging
OrdersSearch by ref or email; charged/refunded, delivery lines, ledger; refund; download the file
Top-upsMark paid when the gateway never called back (idempotent), cancel
CustomersBalance, orders, ledger, reset password, sign out sessions, lock, adjust balance, unlink Telegram
Discount codesCreate, uses, expiry, enable/disable
StatsOrders, units, revenue, customers, top-ups, refunds, wallet liabilities
Audit logEvery money-moving action: who, when, why

Never edit balances with SQL — use "adjust balance" so there is a ledger entry and an audit row. Never delete a product that has sales — switch it off instead.