Request funds-distribution
Update Time:2025.01.07After the Weixin transaction is successfully completed, the merchant initiates a funds-distribution request and distributes the settled funds to the receiver.
|
1. API Intro
Applicable object: Common mode Institutional mode
API rules:https://apihk.mch.weixin.qq.com/v3/global/profit-sharing/orders
Request method:POST
Path parameter is a path parameter.
Query parameter needs to be passed in the request URL.
Body parameter needs to be passed in the request JSON.
2. Request Parameters
Name | Variable Name | Type | Required | Description | |||
---|---|---|---|---|---|---|---|
Sub-merchant ID | sub_mchid | string[1, 32] | No | Body Sub-merchant ID allocated by Weixin Pay. It needs to be consistent with the sub-merchant ID in the transaction of Weixin Pay. | |||
Official account ID | appid | string[1, 32] | No | Body Merchant official account ID allocated by Weixin. When the receiver type includes PERSONAL_OPENID, its filling is required. | |||
Sub-merchant official account ID | sub_appid | string[1, 32] | No | Body Sub-merchant official account ID allocated by Weixin. When the receiver type includes PERSONAL_SUB_OPENID, its filling is required. | |||
Weixin Pay transaction ID | transaction_id | string[1, 32] | Yes | Body Weixin Pay transaction ID | |||
Merchant order No. | out_order_no | string[1, 64] | Yes | Body The order No. in the merchant system, which is unique. It can only include numbers, capital letters and lowercase letters _-. | |||
Whether to unfreeze the remaining undistributed funds | unfreeze_unsplit | boolean | Yes | Body 1. If true, the remaining undistributed funds amount of the transaction will be unfrozen to the sponsor's account outbound;
Example: true | |||
Receiver list | receivers | array[1,50] | No | Body Receiver list. If unfreeze_unsplit=false, the sponsor can be set as the receiver. Otherwise, the funds-distribution request will be rejected. There can be up to 50 receivers. | |||
|
Request Example
Scenario 1
The merchant only needs to call the funds-distribution API once to complete the distribution of transaction funds
The transaction funds amount is CNY10. After deducting the service charge, the remaining amount to be distributed is CNY9.95. In this case, the merchant can initiate the funds-distribution request through [Funds-distribution Request API].
a. Assigned to distribute CNY0.99 to the cooperative merchant (2480248971)
b. Distribute CNY0.99 to the cooperative user (of8YZ9LPmjDmYAddobIvtTdQQjR8)
c. Set unfreeze_unsplit to true and unfreeze the remaining funds to the sponsor outbound. The funds-distribution of the transaction is completed.
Scenario 1:JSON
Scenario 2
The merchant splits the same transaction multiple times for funds-distribution according to its own needs.
The transaction funds amount is CNY200. After deducting the service charge, the remaining amount to be distributed is CNY199. The merchant intends to distribute 50% of the funds (CNY100). In this case, the merchant can initiate the funds-distribution request through [Funds-distribution Request API].
a. Assigned to distribute CNY10 to the cooperative merchant (2480248971);
b. Distribute CNY10 to the cooperative user (of8YZ6LPmjDmYAqdobIvwTdQQjR8);
c. Set unfreeze_unsplit to false (if the remaining amount is frozen, it indicates that the funds-distribution is required subsequently). Specify the sponsor as the receiver and unfreeze CNY80 back to the receiver account to participate in the net settlement of the day.
Scenario 2:JSON
3. Response Parameters
Name | Variable Name | Type | Required | Description | |||
---|---|---|---|---|---|---|---|
Sub-merchant ID | sub_mchid | string[1, 32] | No | Merchant ID allocated by Weixin Pay | |||
Weixin Pay order No. | transaction_id | string[1, 32] | Yes | Weixin Pay transaction ID | |||
Merchant order No. | out_order_no | string[1, 64] | Yes | Merchant order No., same as the request parameter. | |||
Weixin order ID | order_id | string[1, 64] | Yes | Weixin order ID, the unique identifier returned by Weixin system. | |||
Funds-distribution order state | state | string | Yes | Funds-distribution order state (see result field in receivers for funds-distribution results of each receiver). | |||
Receiver list | receivers | array[1,50] | Yes | Receiver list | |||
|
Return Example
Scenario 1
Scenario 2
4. Error Code
Error Codes | Error Message | Description | Solution |
---|---|---|---|
400 | INVALID_REQUEST | The user type is PERSONAL_SUB_OPENID, the sub_appid in parameter is not set | The user type is PERSONAL_OPENID, please set appid field |
400 | INVALID_REQUEST | The user type is PERSONAL_SUB_OPENID, the sub_appid in parameter is not set | The user type is PERSONAL_SUB_OPENID, please set sub_appid field |
400 | INVALID_REQUEST | The user OpenID and the uploaded AppID do not match | Verify under which merchant authorization scenario the OpenID is obtained and set the related AppID field by referring to the description of the receiver type field in the APIs document |
400 | INVALID_REQUEST | Duplicate IDs in the receiver list when requesting funds-distribution | Check receiver list and remove duplicate IDs in the same request before requesting funds-distribution |
400 | INVALID_REQUEST | Personal receiver selects to upload the name field but does not confirm authorized status of user | If the personal receiver selects to upload the name to verify the consistency with user's real-name information, the merchant needs to obtain the user authorization first and set the authorized field to true |
400 | INVALID_REQUEST | The real-name information of the personal receiver on Weixin does not match the uploaded name field value when requesting funds-distribution | Confirm with the receiver their real-name information before executing the request |
400 | INVALID_REQUEST | Currently, only CNY is supported in funds-distribution | Check receiver list and adjust the distribution currency to CNY before requesting funds-distribution |
400 | INVALID_REQUEST | The transaction has exceeded the maximum time limit for funds-distribution | Re-check the payment time of the transaction. Transactions exceeding the maximum time limit for are not allowed to initiate funds-distribution. (the system has initiated unfreezing the funds for settlement outbound) |
400 | INVALID_REQUEST | The transaction does not support funds-distribution | Check whether the Weixin Pay transaction ID is filled in incorrectly and confirm that the Funds-distribution Mark API is called successfully before calling the transaction API |
400 | INVALID_REQUEST | The merchant information in the request of funds-distribution is inconsistent with that in the original transaction | Carefully check whether the transaction ID is filled in correctly and whether the sub-merchant has been filled in or filled in incorrectly |
400 | INVALID_REQUEST | If you choose to unfreeze the remaining undistributed funds amount, that is, set unfreeze_unsplit to true in the funds-distribution request, you cannot add the sponsor as the receiver | If you choose to unfreeze the remaining funds amount to be distributed, that is, set unfreeze_unsplit to true in the funds-distribution request, remove the sponsor account from the receiver list before requesting funds-distribution |
400 | INVALID_REQUEST | When partial unfreezing is selected, the account for the unfrozen funds is filled in incorrectly. (Should be set as the actual sponsor) | Set the sponsor as the actual settled funds Weixin account. Fill in merchant ID for the institution and sub-merchant ID for the service provider |
400 | INVALID_REQUEST | When requesting funds-distribution and it has been verified that the funds receiver relationship does not exist. Check whether all receivers have been added | Check whether all receivers have been added |
400 | INVALID_REQUEST | When requesting funds-distribution and it has been verified that the funds receiver relationship is not in effect or has been terminated. Check whether all receivers are in effect | Check whether all receivers are in effect |
403 | USER_ERROR | There is a receiver that has not been real-name verified in the receiver list, and their Weixin balance account cannot accept the payment request | Check receiver list and confirm that the receiver user has been real-name verified before requesting funds-distribution |
403 | USER_ERROR | There is a receiver whose account is restricted for collection in the receiver list, and their cumulative collection amount in the balance + current collection amount has exceeded the limit | In the case of exceeding the collection amount limit, the restricted user will receive Weixin's push message. Please guide the question receiver to complete the upgrade according to the guidelines before requesting funds-distribution |
403 | USER_ERROR | There is a receiver whose account has hit the Weixin risk interception strategy in the receiver list, and their account is restricted from collection | The user's account intercepted with risk prompts from the platform side is subject to full-scenario collection restriction. Please eliminate the related risky receiver before requesting funds-distribution |
403 | NO_AUTH | The merchant has not signed the overseas funds-distribution product | Refer to the product process and access preparation, confirm that the merchant has funds-distribution authorization, and initiate the request again |
403 | NO_AUTH | The merchant has enabled the funds-distribution product and is waiting for it to take effect (Usually takes effect the next day) | The funds-distribution function cannot be initiated on the first day. Please initiate the request on the next day |
403 | NO_AUTH | Receiver | Confirm that the receiver is legally compliant before requesting funds-distribution |
403 | NO_AUTH | The parent-child relationship of the merchant does not exist. Please use correct sub-merchant ID to initiate the request | Please check if the sub-merchant ID (sub_mchid) is filled in correctly |
400 | INVALID_REQUEST | The command (out_order_no) already exists when the merchant requests funds-distribution and the receiver is inconsistent with that in the existing funds-distribution command | In case of the same funds-distribution request, check whether the receiver information is consistent. In case of different funds-distribution requests, change the command (out_order_no) before requesting funds-distribution |
400 | INVALID_REQUEST | The command (out_order_no) already exists when the merchant requests funds-distribution and the funds-distribution amount is inconsistent with that in the existing funds-distribution command | In case of the same funds-distribution request, check whether the funds-distribution amount is consistent. In case of different funds-distribution requests, change the command (out_order_no) before requesting funds-distribution |
400 | INVALID_REQUEST | The command (out_order_no) already exists when the merchant requests funds-distribution and the funds amount detail is inconsistent with that in the existing funds-distribution command | In case of the same funds-distribution request, check whether the receiver list is consistent. In case of different funds-distribution requests, change the command (out_order_no) before requesting funds-distribution |
400 | INVALID_REQUEST | The command (out_order_no) already exists when the merchant unfreezes the remaining funds and the details are not as expected | In case of different funds-distribution requests, change the command (out_order_no) before requesting funds-distribution |
400 | INVALID_REQUEST | Funds settlement outbound amount cannot be 0 when requesting to unfreeze the distributed funds outbound | Adjust the unfreezing funds amount (CNY) appropriately so that the amount of foreign currency after conversion into foreign currency is greater than 0 |
400 | INVALID_REQUEST | The split funds amount exceeds the maximum split percentage when requesting funds-distribution | Adjust the split funds amount to be within the split ratio limit before requesting funds-distribution |
400 | INVALID_REQUEST | The number of funds-distribution of the transaction has exceeded the maximum funds-distribution times, funds-distribution cannot be initiated. | Call [Unfreeze Remaining Amount API] to unfreeze funds |
403 | NOT_ENOUGH | The funds amount to be distributed is insufficient at the time of request | The current remaining funds amount to be distributed can be obtained through [Remaining Funds Amount to be Distributed Query API] |
500 | SYSYTEM_ERROR | The freeze process of the transaction funds specified by the merchant when initiating funds-distribution request has not been completed. Try again later | After the user completes the payment, the fund freezing process for the transaction with funds-distribution will be triggered. It is recommended that the merchant try again after 3~5 mins |