Skip to content

Topup ​

What it is ​

Topup is the user's online quota purchase. It is not tied to a subscription or plan — it simply adds credit to User.quota.

Order number prefix: TP.

Where to find it ​

  • Public → Top-up: presets, custom amount input, current rate
  • Admin → Top-ups: admin's order list
  • Admin → Top-up Settings: master switch, preset list, rate, custom-amount policy

What you set to enable top-up ​

Admin → Top-up Settings:

FieldMeaningEffect
Master switchEnabled / notOff hides the public entry.
Preset amountse.g. 10 / 50 / 100Quick-pick options in the UI.
Custom amountToggleOff forces users to pick a preset.
Exchange rateQuota per ¥A ¥10 top-up adds 10 × rate to the user's quota.
Min / max amountNumberBounds on what users can enter.

A sane starter:

  • Enabled
  • Presets: 10 / 50 / 100 / 500
  • Custom allowed, min ¥1, max ¥10 000
  • Rate 100000 (matches default QuotaPerUnit=500000)

Operator-relevant fields (per order) ​

FieldMeaningEffect
Order numberTP prefixChanging it breaks the callback.
ParentUser FKCascade-delete with user.
Amount¥Paid amount.
Quotaamount × rateCredited on payment.
StatusUnpaid / Paid / CancelledDrives crediting.
Pay methodWeChat / Alipay / Bank / MockWhich callback URL.

Crediting ​

On "Paid", User.quota is incremented by amount × rate immediately. No manual intervention.

Top-up vs Subscriptions ​

  • Top-up → credited to User.quota, never expires, no plan discount
  • Subscription → drives the plan discount for a fixed period

A user can hold both: top-up balance (no discount) + active subscription (discount applied first).

  • POST /api/topup/order — user creates top-up order
  • GET /api/setting/topup — get settings
  • PUT /api/setting/topup — update settings (Root)