Skip to content

Allocate

Updated: 9/11/26, 8:21:59 PM

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:

ParameterTypeRequiredMaxDescription
bizAllocNostringYes100Merchant allocation number (idempotency key, unique per app)
tradeNostringNo*100Original payment fund trade number
bizOrderNostringNo*100Original payment merchant order number
titlestringNo100Allocation title
descriptionstringNo500Allocation description
receiversobject[]YesReceiver list (at least one)
attachstringNo500Merchant custom data (returned as-is in callback)
notifyUrlstringNo200Async notification URL

*At least one of tradeNo / bizOrderNo required. Priority: tradeNo > bizOrderNo

Receiver Item

ParameterTypeRequiredMaxDescription
receiverTypestringYes32Receiver type (see table below)
receiverAccountstringYes128Receiver account
receiverNamestringNo64Receiver name (required for some channels/types, e.g. WeChat merchant-type receivers need the full merchant name)
amountnumberYesAllocation amount in yuan (2 decimals, min 0.01, max 99999999.99)

receiverType Values

Maps to backend enum AllocReceiverTypeEnum (uppercase type codes used uniformly):

TypeDescription
MERCHANT_IDMerchant ID (WeChat / Douyin)
PERSONAL_OPENIDPersonal openid (WeChat / Douyin)
PERSONAL_SUB_OPENIDSub-merchant app personal openid (WeChat ISV receiver binding only)
USER_IDAlipay user ID (starts with 2088)
LOGIN_NAMEAlipay login account (phone / email)

Example

json
{
  "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:

FieldTypeDescription
allocNostringPlatform allocation number
bizAllocNostringMerchant allocation number
statusstringAllocation status (AllocOrderStatusEnum)
errorMsgstringError message (returned on failure)

Allocation Status (AllocOrderStatusEnum)

statusDescription
processingAllocating (accepted, waiting for async channel result)
successAllocation successful (all receivers succeeded)
partialPartial success (some receivers succeeded, some failed; terminal state for this allocation)
failAllocation failed (all receivers failed)

Example

json
{
  "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=true via 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; partial is a terminal state, failed receivers require a new allocation.
  • Async notification: the platform notifies via notifyUrl once the terminal state is known (events alloc.success / alloc.fail); you may also call Allocation Sync to pull the channel status actively.

Official Website · Released under the GNU LGPL v3.0