English
Allocation
Allocation splits the funds of a payment trade among multiple receivers by rule (partners, franchisees, platform commission, etc.). Usage flow: first register allocation receivers, then (optionally) configure allocation groups, initiate allocation after payment succeeds (manually or automatically), and finally finish the allocation to unfreeze remaining funds in multiple-allocation scenarios.
Capability and Scope
| Item | Description |
|---|---|
| Supported channels | WeChat direct, Alipay direct, Douyin direct; the mock channel is for development integration only |
| Not supported | Service-provider products (wechat_isv / alipay_isv) cannot initiate allocation; other third-party channels have no allocation strategy and are likewise unsupported |
| Order declaration | The original payment order must be created with allocation=true (or tagged automatically by an app-level auto allocation rule) so the funds are frozen and allocatable |
| Receiver registration | WeChat / Alipay direct and ISV products, Douyin direct, and the mock channel all support receiver registration; registration does not imply allocatability (ISV products can only register receivers) |
Overall Flow
Step 1: Register Allocation Receivers
A receiver (the account that receives allocated funds) must first be registered (bound) on the channel side before it can receive allocations.
Entry:
- Merchant panel: Allocation → Allocation Receivers
- Admin panel: Channel Merchants → Channel Merchant Details → Trading Configuration → Allocation Receivers (the "Allocation Receivers" page is hidden in the admin panel by default)

Figure: Channel merchant details → Trading Configuration → Allocation Receivers — filter by receiver type and binding status, add receivers, unbind, or edit aliases; the list shows receiver account, allocation relation, and bound app
Maintained per channel merchant and payment product; supported products:
| Payment product | Register receivers | Initiate allocation |
|---|---|---|
WeChat direct (wechat_pay) | Yes | Yes |
WeChat ISV (wechat_isv) | Yes | No |
Alipay direct (alipay) | Yes | Yes |
Alipay ISV (alipay_isv) | Yes | No |
Douyin direct (douyin_pay) | Yes | Yes |
Mock channel (mock_pay / mock_isv) | Yes | Yes (development only) |
Receiver types (selectable per channel support):
| Type | Description |
|---|---|
| Merchant ID (MERCHANT_ID) | The receiver is another merchant |
| Personal openid (PERSONAL_OPENID / PERSONAL_SUB_OPENID) | WeChat / Douyin personal collection |
| Alipay user ID (USER_ID) | Alipay individual |
| Login name (LOGIN_NAME) | Alipay login account (phone / email) |
Registration supports form entry and scan authorization. Scan authorization generates an authorization QR code; the receiver scans and confirms it and the account is filled in automatically, avoiding transcription errors. Alipay scanning only retrieves the user ID; WeChat / Douyin scanning retrieves the openid under the selected app (a usable official account / website app must be configured).
Binding status: bound / unbound / fail. A failed binding stores the reason and can be retried after correction; unbinding keeps the record so it can be re-bound; deleting removes only the local record and does not affect the channel-side binding.
Permissions
Allocation menus (Allocation Orders / Allocation Groups / Auto Allocation / Allocation Receivers) are governed by the menu code trade:alloc, with action codes trade:alloc:view and trade:alloc:manage.
Step 2: Configure Allocation Groups (Optional)
An allocation group is a preset of "receivers + ratios" referenced by allocation by group and auto allocation.
Entry: Allocation → Allocation Groups (same on both panels)
Rules:
- A group belongs to a channel merchant (the same dimension as receiver registration). One channel merchant can have multiple groups, and group names are unique per channel merchant; only products that support allocation can create groups.
- Each group holds at most 50 members, selected from receivers already registered under that channel merchant; accounts cannot be typed manually.
- Each member has a ratio: entered as a percentage in the UI (0.01% ~ 100%, up to two decimals) and stored as a basis point value (0 ~ 10000); the total ratio must not exceed 100%.
- A channel merchant has at most one default group (the first group becomes the default automatically). The default group cannot be deleted until the default flag is cleared; deleting a group cascades its members.
- Members are a snapshot of the registered record (type / account / name / bound app). Later unbinding does not rewrite an existing member, but allocation filters members by their real-time binding status.
Amount calculation and filtering for allocation by group:
- Member amount = floor (current allocatable base × member ratio ÷ 10000); the rounding remainder stays with the merchant, and ratios are not re-normalized;
- Skipped: members whose record is not bound, personal-type members whose bound app does not match the order's payment app, and members whose calculated amount is 0;
- If no usable member remains after filtering, the request is rejected.
Step 3: Initiate Allocation
Allocation is initiated on trades whose payment succeeded, from the payment trade list:
- Go to Trade Orders → Payment Trades and find a trade with fund status "success" and allocation status "pending";
- Click More → Initiate Allocation in the operation column;
- Choose the allocation method at the top of the drawer:
- By receiver amount: pick a registered receiver (type and account filled automatically — no manual copying) or fill in the receiver type and account row by row (personal openid receivers also need the name), then enter the allocation amount for each receiver;
- By allocation group: pick a group; the drawer previews members and estimated amounts, while the actual amounts are calculated by the backend by ratio;
- After the amount check passes, confirm and submit.
Business systems can also call POST /unipay/alloc (with receivers or groupNo and finishMode for single / multiple allocation); see Initiate Allocation.
Single and multiple allocation:
| Mode | Description |
|---|---|
Finished on success (auto, default) | One request finishes the allocation and unfreezes the remaining funds |
Explicit finish (manual) | Remaining funds stay frozen, more allocations can follow, and the allocation-finish endpoint must be called at the end |
The panel always initiates "finished on success"; multiple allocation requires calling the open API with finishMode=manual, then clicking Finish Allocation on that allocation order in the list, or calling the Allocation Finish API.
Allocation ratio
The allocation ratio cap is enforced by the channel side (e.g. WeChat defaults to 30% of the trade amount; exceeding it is rejected by the channel — the platform performs no ratio check). The allocation amount itself is constrained by the trade's allocatable balance (refundable balance minus allocated and in-flight amounts), and a single request (or group) carries at most 50 receivers.
Step 4: Auto Allocation
Entry: Allocation → Auto Allocation (rules maintained per payment app)
Rule granularity: app + channel merchant, at most one rule per combination (saving again updates it). A rule must select an allocation group belonging to that channel merchant, plus an enabled flag and a delay.
| Item | Description |
|---|---|
| Delay | 0 ~ 10080 minutes (0 ~ 7 days); blank means 30 minutes. The effective value is the larger of the rule delay and the channel minimum interval (WeChat 0s / Alipay 30s / Douyin 60s) |
| Auto tagging | Once enabled, orders of that app under that channel merchant are tagged as allocatable orders at creation (funds frozen), so merchants no longer pass allocation=true manually |
| Auto execution | A task is created after payment success; at the planned time the platform allocates by the group, always finished on success (no separate finish call needed) |
| Skipped | Already handled manually / finished / downgraded, rule disabled or deleted, group invalid, no usable member, insufficient allocatable amount, etc.; the task is marked skipped with a reason |
| Retry | A failed or skipped task can be re-executed manually from the execution records |
| In-flight refund | If a refund is in flight, the task is rescheduled (5 minutes) and retried; after the retry limit it is skipped to avoid funding risk |
| Timeout unfreeze | Orders still pending 7 days after payment success are automatically finished by a daily job (before the channel freeze period expires), avoiding state drift after the channel unfreezes |
Execution records show task status: pending / processing / done / skipped / failed.
Step 5: Query Allocation Orders
Entry: Trade Orders → Allocation Orders (same on both panels)
Query conditions: platform allocation number, merchant allocation number, original payment trade number, allocation type (allocation / finish), allocation status, creation time.
List columns: allocation number, merchant allocation number, trade number, allocation type, amount, status, finish mode, merchant, creation time.

Figure: The allocation order list — allocation and finish records, showing allocation number, fund trade number, allocation type, amount, and allocation status; unfinished manual allocation orders offer "Finish Allocation" in the operation column
Operations: view (details include the allocation details: each receiver's type, account, amount, ratio, result, and completion time; finish orders have no details), sync (pull the latest result from the channel), finish allocation (only for manual allocation orders that are not finished).

Figure: The allocation order detail drawer — identity, related funds, amount and status, and channel snapshot, with the allocation details table listing each receiver's type, account, amount, ratio, and result
Allocation status:
| Status | Description |
|---|---|
| Processing (processing) | Channel processing |
| Success (success) | All receivers allocated / finish succeeded |
| Partial success (partial) | Some receivers succeeded, some failed |
| Failed (fail) | Allocation failed / finish failed |
Related Sections
- Payment Order Management: other operations on payment trades
- Initiate Allocation API, Allocation Finish API
- Allocation Order Query, Allocation Sync