API Download Address for Bill
Update Time:2025.01.07Merchant initiates a request to delete receiver. The settled funds of the merchant cannot be distributed to the deleted receiver.
| 
 | 
1. API Intro
Applicable object: Common mode Institutional mode
API rules:https://apihk.mch.weixin.qq.com/v3/global/profit-sharing/bill-download-url
Request method:GET
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 | Query Sub-merchant ID allocated by WeChat Pay. It needs to be consistent with the sub-merchant ID in the transaction of WeChat Pay. | 
| Bill date | bill_date | string[10, 10] | Yes | Query Format: yyyy-MM-DD | 
Request Example
URL
3. Response Parameters
| Name | Variable Name | Type | Required | Description | 
|---|---|---|---|---|
| Download address | download_url | string[1, 2048] | Yes | The download address of the bill file for the next request is valid for 30 seconds | 
Return Example
SUCCESS
ERROR
File Format Description
- The bill file includes two parts: detailed data and summary data. Each part contains one line of header and several lines of specific data; 
- In the detail data table, funds-distribution is recorded in each line , and each data is preceded by a character ` to avoid being processed by Excel. You can replace the character in batches to summarize the amount and other data. 
- Data table header format:create_time,initiator,sponsor,sub_mchid,transaction_id,order_id,out_order_no,detaill_id,receiver_account,amount,currency, 
settlement_amount,settlement_currency,exchange_rate,business_type,status,description; The explanations of the headers are in the following table:
| Variable | Parameter name | Description | 
|---|---|---|
| create_time | Funds-distribution initiation time | System acceptance time of the merchant's funds-distribution request/the system's unfreezing command | 
| initiator | Funds-distribution initiator | If the funds-distribution is initiated by a merchant, the initiator is the merchant ID. If the funds-distribution is initiated by the system, the initiator is "System". | 
| sponsor | Funds-distribution sponsor | The actual contributed merchant ID is the same as that of the settled funds account | 
| sub_mchid | Sub-merchant ID | The sub-merchant ID of the transaction corresponding to the funds-distribution | 
| transaction_id | Weixin Pay order No. | WeChat Pay transaction ID with funds-distribution mark | 
| order_id | WeChat order ID | When requesting funds-distribution, WeChat returns the order ID to the merchant | 
| out_order_no | Merchant order No. | When the merchant requests funds-distribution, the merchant order No. is generated. When the system unfreezes the remaining funds to sponsor, this field is null | 
| detaill_id | WeChat funds-distribution detail ID | The transfer detail ID corresponding to the funds-distribution to the receiver at the merchant's request | 
| receiver_account | Account of receiver | When the funds are distributed, there is an account of receiver. When the business_type=TO_SPONSOR, the receiver_account is null | 
| amount | Funds-distribution amount | Actual amount of funds-distribution in the order | 
| currency | Distribution currency | 
 | 
| settlement_amount | Settled funds amount outbound | Only when business_type=TO_SPONSOR, there is settlement amount | 
| settlement_currency | Settlement currency | Only when business_type=TO_SPONSOR, there is settlement amount | 
| exchange_rate | Exchange rate | Only when business_type=TO_SPONSOR, there is settlement amount | 
| business_type | Business type | Distribute funds: TO_ACCEPTOR; unfreeze the remaining funds: TO_SPONSOR | 
| status | Status | "SUCCESS". Currently, only successful funds-distribution orders are listed in the bill. | 
| description | Funds-distribution description | Funds-distribution description uploaded by the merchant. If the system initiates the unfreezing command, the description is "Unfreeze the remaining funds to sponsor" | 
- Summary table header format: total_count, total_amount_to_sponsor, total_amount_to_acceptor; Explanations of the headers are: total number of funds-distribution orders in the bill, total unfrozen funds amount released of the day, and total distributed funds amount of the day; 
- There are empty lines between the data lines and the summary header. 
Example of bill
4. Error Code
| Error Codes | Error Message | Description | Solution | 
|---|---|---|---|
| 400 | NO_STATEMENT_EXIST | The requested bill file does not exist | Check whether the current merchant ID has successful funds-distribution orders on the specified date | 
| 400 | STATEMENT_CREATING | Generating bill file | Check whether the current merchant ID has successful funds-distribution orders within the specified date. If yes, download the file again after 10: 00 am on day T+1 | 
| 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 | 
| 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 | 



