May 20, 2021 WeChat Mini Program Development Document
Support: Cloud function 2.0.2
Download the statement
Merchants can download a list of historical transactions through this interface. For example, drop orders, system errors, etc. lead to inconsistent merchant side and WeChat side data, through the bill check can be corrected payment status.
Attention:
1, WeChat side did not successfully place the transaction will not appear in the statement. Transactions cancelled after successful payment will appear in the statement, consistent with the order number of the original payment order;
2, WeChat in the next day at 9 o'clock to start generating the previous day's statement, suggested that merchants after 10 o'clock to obtain;
3. The field unit of the amount involved in the statement is Yuan.
4, the statement interface can only download bills within three months.
5, the statement is generated by the latitude of the merchant number, such as a merchant number and multiple appid binding relationship, then use any of the appid can request to download the statement. The appid in the statement is taken from the appid submitted at the time of the transaction and has nothing to do with the appid used when requesting the statement to be downloaded.
6, small micro-merchants do not provide a separate statement download, if necessary, you can access the "download statement" API interface do not pass sub_mch_id, access to the service provider under the full number of special merchants (including small micro-merchants and non-small micro-merchants) statements.
The field name | The name of the variable | Required | Type | The sample value | Describe |
---|---|---|---|---|---|
Sub-merchant number | sub_mch_id | Whether | String(32) | 1900000109 | WeChat pays the distributed submarket number, if you need to download the specified sub-account statement, this parameter must be passed. |
Random string | nonce_str | Yes | String(32) | 5K8264ILTKCH16CQ2502SI8ZNMTM67VS | Random strings, not less than 32 bits.Recommended random number generation algorithm |
sign | sign | Yes | String(32) | C380BEC2BFD727A4B6845133519F3AD6 | Signature, see the signature generating algorithm |
Statement date | bill_date | Yes | String(8) | 20140603 | Download the date, format: 20140603 |
Bill type | bill_type | no | String(8) | ALL |
All, return all order information on the day, default
Success, returning to the order successfully paid on the same day REFUND, return to the new day refund order |
Compressed bill | tar_type | no | String | GZIP | Non-essential parameters, fixed value: gzip, return format is the compressed package bill for .gzip.Do not pass the default is a data stream form. |
Returns the following fields when failing
Field name | variable name | Required | type | Sample value | describe |
---|---|---|---|---|---|
Return status code | returnCode | Yes | String(16) | FAIL | FAIL |
Error code description | returnMsg | no | String(128) | Signature failed | Returns information, such as non-empty, for error reasons, such as: signature failure, etc. |
Error code | errorCode | Whether | String(16) | 20002 | Failure error codes, see the list of error codes |
When successful, the data is returned as a text table, the first behavior header, the field content corresponding to each behavior, the field content is consistent with the query order or refund results, the specific field description can be consulted the corresponding interface.
The first behavior header, depending on the type of statement downloaded by request (determined by bill_type), currently has: all orders for the day, transaction time, service provider's APPID, merchant number, sub-merchant number, device number, WeChat order number, merchant Order number, user identification, transaction type, transaction status, payment bank, currency type, total amount, voucher or discount amount, WeChat refund slip number, merchant refund order number, refund amount, voucher or discount refund amount, refund type , refund status, product name, merchant packet, handling fee, rate order successfully paid on the same day, transaction time, service provider's APPID, merchant number, sub-merchant number, device number, WeChat order number, merchant order number, user identification, transaction type, transaction Status, payment bank, currency type, total amount, voucher or discount amount, product name, merchant packet, handling fee, rate of refund on the same day order, transaction time, service provider's APPID, merchant number, sub-merchant number, device number, WeChat order number, merchant order number, user identification, transaction type, transaction status, payment bank, currency type, total amount, voucher or discount amount, refund request time, refund success time, WeChat refund slip number, merchant refund order number, refund amount, voucher or discount refund amount, refund type, refund status, product name, merchant packet, handling fee, rate
Starting from the second line, for the data record, each parameter is separated by a comma, the parameter is added before the 'symbol, is the character of the left key of the standard keyboard 1, the field order is the same as the header.
The penultimate behavior order statistics title, the last behavior statistics
Total transaction orders, total transaction amount, total refund amount, total voucher or discount refund amount, total handling fee amount
For example:
Transaction time, service provider's APPID, merchant number, sub-merchant number, device number, WeChat order number, merchant order number, user identification, transaction type, transaction status, payment bank, currency type, total amount, voucher or discount amount, WeChat refund form Merchant refund slip number, refund amount, voucher or discount refund amount, refund type, refund status, product name, merchant packet, handling fee, rate 2014-11-10 16:33:45, w x2421b1c4370ec43b, 10000100,0,1000,100169074020141100005734289,1415640 626,085e9858e3ba5186aafcbaed1, MICROPAY, SUCCESS, OTHERS, CNY, 0.01, 0.0, 0,0,0,0,0,,,Seinded payment test, additional description of the order, 0 ,0.60% 2014-11-10 16:46:14,wx2421b1c4370ec43b,10000100,0,1000,1002780740201411100005729794,1415635270,085e9858e90ca40c0b5aee463,MICROPAY,SUCCESS,OTHERS,CNY, 0.01,0.0,0,0,0,0,,, Swept Payment Test, Order Extra Description, 0,0.60% Total Transaction Order, Total Transaction Amount, Total Refund Amount, Total Voucher or Discount Refund Amount, Total Fee Amount 2,0.02,0.0,0.0 Settlement Statement
General settlement statements
The name of the field | The sample value | The field description |
---|---|---|
Trading hours | 2017-12-14 15:49:06 | Refers to the successful time of payment of the transaction or the time of successful initiation of the refund (Note: not the successful time of the refund), in the format YYYY-MM-DD HH:MM:SS, e.g. 2015-01-01 10:00:00 |
Public account ID | wxab8acb865bb11234 | The appid used to initiate the transaction, which is a unique identification assigned to the public number or app by the WeChat platform to distinguish the trading scenario |
Merchant number | 1234567890 | WeChat payment merchant number, 8 to 10 digits, initiated the transaction |
Sub-merchant number | 0 |
If it is a transaction in normal acceptance mode, show the merchant number of the special merchant, 8 to 10 digits
If it is traded in direct mode, it is shown as a number 0 |
The device number | 8888 | The information passed in in the device_info when the transaction is ordered is left blank if it is not filled in |
WeChat order number | 4200000008201712143733500001 | WeChat pays the order number assigned to the order (or the order for which the refund corresponds). |
Merchant order number | test1 | The merchant order number for the order (or the order for which the refund corresponds) that the merchant has passed in, corresponding to the entry field in out_trade_no order |
The user ID | testxt08c-XB5-QD208X1Aid0Cbs | WeChat platform for payment users under the public account (appid) assigned a unique identity (openid) |
The type of transaction | NATIVE |
The transaction type of the order (or the order corresponding to the refund slip), displayed using an abbreviation, value and meaning: Value:
JSAPI-JSAPI payment (or small program payment) NATIVE-Native payments APP-app payment MWEB-H5 payment MICROPAY - Payment code payment PAP- Delegate withholding |
The status of the transaction | SUCCESS |
SUCCESS - A successful payment indicates that the bank data is a successful payment order
REFUND - Transfer to a refund, indicating that the bank's data is a successful refund form for initiating a refund REVOKED - Revoked, indicating that the row data is a successful revocation order |
Payment bank | OTHERS | Bank type, a bank identity with a string type, CMC_CREDIT, as shown in https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=4_2 |
The type of currency | CNY | Currency type, a three-letter code that complies with ISO 4217, such as CNY |
The total amount | 0.01 | The settlementable amount of the order (-order amount - the amount of the user-free recharge voucher used by the user) is displayed at 0.00, unit dollars, and retained 2 places after the tap if the bank data is refunded or revoked |
Vouchers or discount amounts | 0.00 | The amount of WeChat payment vouchers used in this order (including recharge vouchers and top-up vouchers) is displayed 0.00, units, reserved 2 places after the sub-point if the voucher is not used, or if the bank data is refunded or revoked |
WeChat refund slip number | 0 | WeChat pays the refund slip number assigned for the refund, which is shown as 0 if the line data is an order |
Merchant refund slip number | 0 | The merchant refund form number that is filled in when the merchant initiates the refund, and 0 is displayed if the line data is the order |
Refund amount | 0.00 | The settlementable amount of the refund or revocation order (request refund amount - refund amount of the coupon free of charge) is displayed as 0.00 if the line data is an order, non-negative, unit dollar, reserved 2 places after the tap point |
Vouchers or reduced refund amounts | 0.00 | The refund amount included in the recharge voucher refund amount, if the bank data is an order or no recharge voucher refund is shown as 0.00, non-negative, unit yuan, reserved 2 places after the tap |
The type of refund |
ORIGINAL - Original refund
BALANCE - Return to the user's WeChat to pay for change If the row data is an order, it is left blank |
|
Refund status |
The status of the refund is not updated when the billing file is generated, and if the line data is an order, it is left blank
SUCCES - Refund was successful FAIL - Refund failed M PROCESSING - Refund processing |
|
The name of the product | Chinese .body | The product name of the order (or the order for which the refund corresponds) that the merchant has passed in, corresponding to the body field in the ordering interface |
Merchant packets | Test Chinese (attach) | The merchant packet for the order (or the order for which the refund corresponds to) that the merchant has passed in, corresponding to the attach field in the ordering interface, is left blank when it is not passed |
Handling fees | 0.00000 | The order/refund corresponds to the amount of the handling fee, the order corresponds to the positive number, the refund corresponds to the negative number, the unit dollar, retains the second place after the point of the few points |
Rates | 0.00% | The rate, percentage, such as 0.60% used for billing the transaction |
Settle statements after opening a top-up voucher
The name of the field | The sample value | The field description |
---|---|---|
Trading hours | 2017-12-14 15:49:06 | Refers to the successful time of payment of the transaction or the time of successful initiation of the refund (Note: not the successful time of the refund), in the format YYYY-MM-DD HH:MM:SS, e.g. 2015-01-01 10:00:00 |
Public account ID | wxab8acb865bb11234 | The appid used to initiate the transaction, which is a unique identification assigned to the public number or app by the WeChat platform to distinguish the trading scenario |
Merchant number | 1234567890 | WeChat payment merchant number, 8 to 10 digits, initiated the transaction |
Special merchant number | 0 |
If it is a transaction in normal acceptance mode, show the merchant number of the special merchant, 8 to 10 digits
If it is traded in direct mode, it is shown as a number 0 |
The device number | 8888 | The information passed in in the device_info when the transaction is ordered is left blank if it is not filled in |
WeChat order number | 4200000008201712143733500001 | WeChat pays the order number assigned to the order (or the order for which the refund corresponds). |
Merchant order number | test1 | The merchant order number for the order (or the order for which the refund corresponds) that the merchant has passed in, corresponding to the entry field in out_trade_no order |
The user ID | testxt08c-XB5-QD208X1Aid0Cbs | WeChat platform for payment users under the public account (appid) assigned a unique identity (openid) |
The type of transaction | NATIVE |
The transaction type of the order (or the order corresponding to the refund slip), displayed using an abbreviation, value and meaning: Value:
JSAPI-JSAPI payment (or small program payment) NATIVE-Native payments APP-app payment MWEB-H5 payment MICROPAY - Payment code payment PAP- Delegate withholding |
The status of the transaction | SUCCESS |
SUCCESS - A successful payment indicates that the bank data is a successful payment order
REFUND - Transfer to a refund, indicating that the bank's data is a successful refund form for initiating a refund REVOKED - Revoked, indicating that the row data is a successful revocation order |
Payment bank | OTHERS | Bank type, a bank identity with a string type, CMC_CREDIT, as shown in https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=4_2 |
The type of currency | CNY | Currency type, a three-letter code that complies with ISO 4217, such as CNY |
The amount of the order to be closed | 0.01 | The settlementable amount of the order (-order amount - the amount of the user-free recharge voucher used by the user) is displayed at 0.00, unit dollars, and retained 2 places after the tap if the bank data is refunded or revoked |
The amount of the voucher | 0.00 | The amount of WeChat payment vouchers used in this order (including recharge vouchers and top-up vouchers) is displayed 0.00, units, reserved 2 places after the sub-point if the voucher is not used, or if the bank data is refunded or revoked |
WeChat refund slip number | 0 | WeChat pays the refund slip number assigned for the refund, which is shown as 0 if the line data is an order |
Merchant refund slip number | 0 | The merchant refund form number that is filled in when the merchant initiates the refund, and 0 is displayed if the line data is the order |
Refund amount | 0.00 | The settlementable amount of the refund or revocation order (request refund amount - refund amount of the coupon free of charge) is displayed as 0.00 if the line data is an order, non-negative, unit dollar, reserved 2 places after the tap point |
The amount of the recharge voucher refund | 0.00 | The refund amount included in the recharge voucher refund amount, if the bank data is an order or no recharge voucher refund is shown as 0.00, non-negative, unit yuan, reserved 2 places after the tap |
The type of refund |
ORIGINAL - Original refund
BALANCE - Return to the user's WeChat to pay for change If the row data is an order, it is left blank |
|
Refund status |
The status of the refund is not updated when the billing file is generated, and if the line data is an order, it is left blank
SUCCES - Refund was successful FAIL - Refund failed M PROCESSING - Refund processing |
|
The name of the product | Chinese .body | The product name of the order (or the order for which the refund corresponds) that the merchant has passed in, corresponding to the body field in the ordering interface |
Merchant packets | Test Chinese (attach) | The merchant packet for the order (or the order for which the refund corresponds to) that the merchant has passed in, corresponding to the attach field in the ordering interface, is left blank when it is not passed |
Handling fees | 0.00000 | The order/refund corresponds to the amount of the handling fee, the order corresponds to the positive number, the refund corresponds to the negative number, the unit dollar, retains the second place after the point of the few points |
Rates | 0.00% | The rate, percentage, such as 0.60% used for billing the transaction |
The order amount | 0.01 | The amount of the order, including the amount paid by the user, the amount of the recharge voucher, the amount of the coupon free, if the bank data is refunded or cancelled, fill 0.00, unit yuan, reserved 2 places after the tap |
Request a refund amount | 0.00 | The amount of the refund initiated by the merchant, including the amount returned to the user, the amount of the refund of the recharge voucher, the amount of the refund of the free recharge voucher, if the data order of the bank is filled in 0.00, unit yuan, reserved 2 places after the tap |
Rate notes | If there are special rate rules to describe, leave them blank by default |
Error code | Name | Describe | Reason | Solution |
---|---|---|---|---|
20003 | SYSTEMERROR | The download failed | The system timed out | Try querying again. |
20001 | sign error | The signature is wrong | The request parameters were not filled in as required | The signature error, please re-check the parameters and signature key is correct |
20001 | nonce_str too long | The nonce_str error | The request parameters were not filled in as required | The nonce_str parameter is too long |
20001 | invalid tar_type, Only GZIP supported | The tar_type error | The request parameters were not filled in in accordance with the guidelines | Please re-check the parameter invalid tar_typ is correct |
20001 | invalid bill_type | The bill_type error | The request parameters were not filled in in accordance with the guidelines | Please re-check the parameters bill_type are correct |
20001 | invalid bill_date | The bill_date error | The request parameters were not filled in in accordance with the guidelines | Please re-check the parameters bill_date the parameters meet the requirements |
20001 | require POST method | The request was made in the wrong way | The request method does not meet the requirements | The request checks whether the parameter request is posted |
20001 | empty post data | The request message is incorrect | The request message is empty | Please re-check that the request message is correct |
20001 | data format error | The argument is in the wrong format | The request parameters are required to be in xml format | Please re-check that the request parameter format is xml |
20001 | missing parameter | The argument is missing | There are required parameters that have not been uploaded | Please re-check that all required parameters have been uploaded and are not empty |
20001 | invalid appid | The appid is wrong | The request parameter appid is incorrect | Please re-check that the parameter appid is correct |
20001 | invalid parameter | The argument is wrong | There are unknown request parameters | Please re-check that all parameters match the documentation |
20001 | sub_mch not allow | The special merchant number permission is incorrect | There is no download permission for this special merchant bill | Please check that the special merchant number is correct. If it is a small micro-merchant, it may not be sub_mch_id to obtain the full amount of special merchant's bill under the service provider |
20002 | NO Bill Exist | The bill does not exist | There are no closed orders at the current merchant number and no statements are generated | Please check if the current merchant number has a successful transaction within the specified date. |
20002 | Bill Creating | The bill was not generated | There are no closed orders or statements for the current merchant number that have not been generated | Please check whether the current merchant number has a successful transaction within the specified date, if there are transactions on the specified date indicating that the bill is being generated, please download it after 10 a.m. |
20007 | The current Merchant Billing API permission has been turned off | The current Merchant Billing API permission has been turned off | The current Merchant Billing API permission has been turned off | The current merchant billing API permission has been closed, please contact WeChat payment to resolve |
20100 | system error | The download failed | The system timed out | Try querying again. |