English
Allocation Finish
Description
Finish an allocation order and unfreeze the remaining frozen funds to the merchant itself. Use it when:
- Allocated but not finished (
allocated): after all receivers of a multiple allocation (finishMode=manual) are settled, call this endpoint to unfreeze the remaining funds; - Pending allocation (
none): the funds were frozen at order creation but no allocation has been made yet; the order can also be finished directly to unfreeze funds that do not need to be split.
Single allocations (finishMode=auto, allocation completes immediately) are unfrozen automatically upon success and do not need this call.
On the platform, a finish request is stored as an allocType=finish order (no receiver details, amount 0) and shares the allocation order table, sync, and notification pipeline.
Product and channel limits
Allocation is supported only by WeChat / Alipay / Douyin direct products (the mock channel is for integration testing only). Service-provider products (wechat_isv / alipay_isv) and other third-party channels do not support allocation or finish. Finishing also requires the channel to support standalone finish, which all allocation-capable channels currently do.
Request
POST /unipay/alloc-finish
- Auth: RSA signature (
@PaymentVerify) - Response:
DaxResult<AllocResult>
Parameters
Common params same as Pay - Common Parameters. Business parameters:
| Parameter | Type | Required | Max | Description |
|---|---|---|---|---|
| bizAllocNo | string | Yes | 100 | Merchant allocation number (idempotency key, unique per app, sharing the same dimension as allocation orders, not reusable) |
| tradeNo | string | No* | 100 | Original payment fund trade number |
| bizOrderNo | string | No* | 100 | Original payment merchant business order number |
| description | string | No | 500 | Finish description |
| attach | string | No | 500 | Merchant custom data (returned as-is in callback) |
| notifyUrl | string | No | 200 | Async notification URL |
*At least one of
tradeNo/bizOrderNorequired. Priority: tradeNo > bizOrderNo
Idempotency and Numbers
bizAllocNois the idempotency key and shares the same dimension as allocation orders: a number already used for an allocation or a finish under the same app cannot be used again, and a duplicate submission is rejected outright (the existing order is not returned).- Always use a new
bizAllocNofor the finish; do not reuse a previous allocation's merchant number. - An original payment order can have at most one successful finish order; after it succeeds, no further allocation is allowed.
Example
json
{
"mchNo": "M200000001",
"appId": "APP001",
"reqId": "REQ20241201032",
"reqTime": "2024-12-01 13:00:00",
"sign": "Base64Signature",
"bizAllocNo": "ALOC20241201002",
"tradeNo": "T2024120112345700001",
"description": "Allocation Finish",
"notifyUrl": "https://your-domain.com/notify"
}Response
DaxResult<AllocResult>; the data structure is the same as the Allocate Response:
| Field | Type | Description |
|---|---|---|
| allocNo | string | Platform allocation finish number |
| bizAllocNo | string | Merchant allocation number |
| status | string | Allocation status (AllocOrderStatusEnum); the terminal result is subject to the async notification or allocation sync |
| errorMsg | string | Error message (returned on failure) |
On acceptance it returns allocNo and bizAllocNo; the terminal result is obtained via async notification (events alloc.success / alloc.fail) or Allocation Sync.
Example
json
{
"code": 0,
"msg": "success",
"data": {
"allocNo": "A2024120113000000001",
"bizAllocNo": "ALOC20241201002"
},
"sign": "Base64Signature",
"resTime": "2024-12-01 13:00:00",
"reqId": "REQ20241201032"
}Usage Tips
- When to call: in multiple-allocation mode, the last allocation may pass
finishMode=autoto finish with the allocation, or all allocations may usemanualand this endpoint is called once at the end; a pending order can be finished directly. - Only specific states can finish: the original payment must be successful and its allocation status must be
none(pending) orallocated(allocated but not finished);processing(in flight),finished/done(already finished),unsupported(product unsupported and downgraded), and non-allocation orders are rejected. - No allocation after finish: a successful finish unfreezes the remaining funds and moves the original payment to the
finishedterminal state. - Back-office entry: the allocation order list offers a "Finish Allocation" action for
finishMode=manualallocation orders (see Allocation); single allocations do not show the entry. - Async notification: the platform notifies via
notifyUrlonce the terminal state is known (eventsalloc.success/alloc.fail); you may also call Allocation Sync to pull the channel status actively.