Skip to content

Order ​

What it is ​

Order is the unified record for every paid action — new plan, plan upgrade, top-up. The order number prefix encodes the type:

  • TB — new plan
  • UP — upgrade differential
  • TP — top-up (see Topup)

Where to find it ​

  • Public → My Orders: the current user's orders and statuses
  • Admin → Orders: admin view with filters
  • Payment callbacks: third-party payment callbacks identify the order by number

Operator-relevant fields ​

FieldMeaningEffect
Order numberTB / UP / TP prefix + timestamp + randomChanging it breaks payment callbacks.
ParentUser FKCascade-delete with user.
TypeNew / Upgrade / Top-upDrives the downstream fulfillment.
Plan FKTarget planFor upgrades only.
Subscription FKActivated subscriptionSet when fulfillment completes.
Amount¥What was actually paid.
StatusUnpaid / Paid / Cancelled / RefundedDrives fulfillment and refunds.
Pay methodWeChat / Alipay / Bank / MockWhich callback URL is hit.

Lifecycle ​

Unpaid → (user pays) → Paid → (system activates subscription / credits) → Done
       ↘ (cancel / timeout) → Cancelled

Activation ​

On "Paid", the system:

  1. Creates or extends a Subscription
  2. For upgrade orders, pro-rates the remaining quota from the old subscription

Activation is asynchronous — it happens within seconds of the callback.

Refunds ​

Triggered from the order detail page. Refunds:

  1. Mark the order as "Refunded"
  2. Cancel the linked subscription
  3. Do not refund quota already consumed
  • POST /api/order/plan — user creates a plan order
  • GET /api/order/self — current user's orders
  • GET /api/order/ — list (admin)
  • PUT /api/order/:id — mark paid (admin)
  • DELETE /api/order/:id — delete (Root)