Allocate
Description
Initiate an allocation against an allocatable payment order. The original payment order must be created with allocation=true (via Pay or Gateway Pre-pay) so the funds are frozen and can be allocated; otherwise the channel will reject the allocation.
The receiver list is passed in full in the request (minimal mode). Allocation receivers must be bound on the channel side in advance (the platform admin panel provides binding management in "Channel Merchant Details"); this endpoint only splits the amount.
Request
POST /unipay/alloc
- 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) |
| tradeNo | string | No* | 100 | Original payment fund trade number |
| bizOrderNo | string | No* | 100 | Original payment merchant order number |
| title | string | No | 100 | Allocation title |
| description | string | No | 500 | Allocation description |
| receivers | object[] | Yes | — | Receiver list (at least one) |
| 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
Receiver Item
| Parameter | Type | Required | Max | Description |
|---|---|---|---|---|
| receiverType | string | Yes | 32 | Receiver type (see table below) |
| receiverAccount | string | Yes | 128 | Receiver account |
| receiverName | string | No | 64 | Receiver name (required for some channels/types, e.g. WeChat merchant-type receivers need the full merchant name) |
| amount | number | Yes | — | Allocation amount in yuan (2 decimals, min 0.01, max 99999999.99) |
receiverType Values
Maps to backend enum AllocReceiverTypeEnum (uppercase type codes used uniformly):
| Type | Description |
|---|---|
| MERCHANT_ID | Merchant ID (WeChat / Douyin) |
| PERSONAL_OPENID | Personal openid (WeChat / Douyin) |
| PERSONAL_SUB_OPENID | Sub-merchant app personal openid (WeChat ISV receiver binding only) |
| USER_ID | Alipay user ID (starts with 2088) |
| LOGIN_NAME | Alipay login account (phone / email) |
Example
{
"mchNo": "M200000001",
"appId": "APP001",
"reqId": "REQ20241201030",
"reqTime": "2024-12-01 12:30:00",
"sign": "Base64Signature",
"bizAllocNo": "ALOC20241201001",
"tradeNo": "T2024120112345700001",
"title": "Order Allocation",
"receivers": [
{
"receiverType": "USER_ID",
"receiverAccount": "2088xxxxxxxxxxxx",
"receiverName": "Zhang San",
"amount": 30.00
},
{
"receiverType": "USER_ID",
"receiverAccount": "2088yyyyyyyyyyyy",
"amount": 70.00
}
],
"notifyUrl": "https://your-domain.com/notify"
}Response
DaxResult<AllocResult>, data fields:
| Field | Type | Description |
|---|---|---|
| allocNo | string | Platform allocation number |
| bizAllocNo | string | Merchant allocation number |
| status | string | Allocation status (AllocOrderStatusEnum) |
| errorMsg | string | Error message (returned on failure) |
Allocation Status (AllocOrderStatusEnum)
| status | Description |
|---|---|
| processing | Allocating (accepted, waiting for async channel result) |
| success | Allocation successful (all receivers succeeded) |
| partial | Partial success (some receivers succeeded, some failed; terminal state for this allocation) |
| fail | Allocation failed (all receivers failed) |
Example
{
"code": 0,
"msg": "success",
"data": {
"allocNo": "A2024120112345700001",
"bizAllocNo": "ALOC20241201001",
"status": "processing"
},
"sign": "Base64Signature",
"resTime": "2024-12-01 12:30:00",
"reqId": "REQ20241201030"
}Usage Tips
- Declare allocation at order creation: the original payment must be created with
allocation=truevia Pay (or Gateway Pre-pay) so the funds are frozen; otherwise the channel rejects allocation. - Bind receivers in advance: receiver binding is completed on the channel side by the caller (admin panel "Channel Merchant Details" provides the binding UI). Bindings are per channel merchant — the same channel merchant/type/account cannot be bound twice; receivers must be bound before allocation.
- Amount constraints: per-receiver allocation amount is 0.01 ~ 99999999.99 yuan (max 2 decimals); the total must not exceed the original order amount and must stay within the remaining allocatable amount.
- Single-shot allocation: one request completes the allocation — no follow-up allocation;
partialis a terminal state, failed receivers require a new allocation. - 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.