Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use CloudPay.downloadBill () in Wechat Development

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

Editor to share with you how to use CloudPay.downloadBill () in Wechat development, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to understand it!

CloudPay.downloadBill ()

Supporting end: cloud function 2.0.2

Download statement

Description

Merchants can download the list of historical transactions through this interface. For example, drop orders, system errors and so on lead to inconsistent data between merchant side and WeChat side, and the payment status can be corrected after checking the bill.

Note:

1. Transactions that failed to place orders on Wechat side will not appear in the statement. Transactions cancelled after successful payment will appear in the statement, consistent with the original payment order number

2. Wechat starts to generate the statement of the day before at 9: 00 the next day. It is recommended that merchants obtain it after 10:00.

3. The field unit of the amount involved in the statement is "yuan".

4. The statement API can only download bills within three months.

5. The statement is generated based on the latitude of the merchant number. If a merchant number is bound to multiple appid, you can request to download the statement using any of these appid. The appid in the statement is taken from the appid submitted at the time of the transaction, regardless of the appid used when the statement is requested to be downloaded.

6. Small and micro merchants do not provide statement download separately. If necessary, do not send sub_mch_id when calling the [download statement] API, and obtain the statements of all contracted merchants (including small and micro merchants and non-small and micro merchants) under the service provider.

Parameter description

Field name variable name required type sample value description

Sub-merchant number sub_mch_id No String (32) 1900000109 sub-merchant number assigned by WeChat Pay. This parameter must be passed if you need to download the specified sub-merchant account statement.

The random string nonce_str is a String (32) 5K8264ILTKCH16CQ2502SI8ZNMTM67VS random string that is no longer than 32 bits. Recommended random number generation algorithm

Signature sign is a String (32) C380BEC2BFD727A4B6845133519F3AD6 signature. For more information, please see the signature generation algorithm.

Statement date bill_date is the date of the String (8) 20140603 download statement, format: 20140603

Bill type bill_type No String (8) ALLALL, returns all order information of the day. Default value

SUCCESS, which returns the order successfully paid on the same day

REFUND, return the same-day refund order

Compressed bill tar_type No StringGZIP is not a required parameter. Fixed value: GZIP. The compressed package bill is returned in .gzip format. If it is not passed, it defaults to the form of data stream.

Return value description

On failure, return the following fields

Field name variable name required type sample value description

The return status code returnCode is String (16) FAILFAIL

Error code description: invalid Msg No string (128) signature failed. If it is not empty, it is the reason for the error, such as signature failure.

Error codes errorCode No String (16) 20002 error codes. For more information, please see the list of error codes.

When successful, the data is returned in the form of a text table. The first behavior header, the field content corresponding to each subsequent behavior, and the field content are consistent with the query order or refund result. The specific field description can be found in the corresponding API.

The first behavior header varies according to the type of statement requested to download (determined by bill_type). Currently, there are: all orders * transaction time of the day, APPID of the service provider, 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 deduction discount amount, Wechat refund order number Merchant refund order number, refund amount, voucher or deduction discount refund amount, refund type, refund status, commodity name, merchant data packet, handling fee, order paid successfully 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 deduction discount amount, commodity name, merchant package, handling fee, rate same-day refund order * transaction time, service provider's APPID, merchant number, sub-merchant number, equipment number, Wechat order number, merchant order number, user identification, transaction type, transaction status, payment bank, currency type, total amount, voucher or deduction discount amount, refund application time, refund success time Wechat refund order number, merchant refund order number, refund amount, voucher or deduction discount refund amount, refund type, refund status, commodity name, merchant data package, handling fee, rate

From the second line, the data is recorded, and the parameters are separated by commas. The `symbol is added before the parameters, which is the character of the left key of the standard keyboard 1, and the order of the fields is the same as the header.

The penultimate behavior order statistics title, the last behavior statistics

Total order number, total transaction volume, total refund amount, total voucher or deduction discount refund amount, total handling fee amount

Examples are as follows:

Transaction time, service provider's APPID, merchant number, sub-merchant number, device number, Wechat order number, merchant order number, user ID, transaction type, transaction status, payment bank, currency, total amount, voucher or deduction discount amount, Wechat refund order number, merchant refund order number, refund amount, voucher or deduction discount refund amount, refund type, refund status, commodity name, merchant data package Service Charge, The rate is 2014-11-10 16purse 33purl 45recoverwx2421b1c4370ec43bmag1000010010505110005734289149074026085e9858e3ba5186aafcbaed1MICROPAYMICROPAYmSUCCESSMICROPAYMICROPAYMICROPAYMICROPAYRESUCCESSSCELEOTHERSRESSMENT CNYE 0.01, the order was scanned for payment test, the order was extra described, the order 0.60%, the order 4370ecb43, the number of transactions wx2421b1c4370ecbmm10000100, 10000,00,29794, 1415635270085e9858e9090caee0baee546, the total transaction amount was 0.00, the total transaction amount was scanned, the total transaction amount was 0. 0%, the total transaction amount was swept, and the total transaction amount was described. Total voucher or deduction discount refund amount, the total amount of handling fee is 2.02pm 0.050.0, `0 settlement statement *

General settlement statement

Field name sample value field description

Transaction time 2017-12-14 15:49:06 refers to the time when the transaction was paid successfully or when a refund was initiated (note: it is not a refund success time), in the format of YYYY-MM-DD HH:MM:SS, such as 2015-01-01 10:00:00

The appid,appid used by the public account IDwxab8acb865bb11234 when initiating the transaction is the unique identification assigned by the Wechat platform to the official account or app to distinguish the transaction scenarios.

Merchant number 1234567890 WeChat Pay merchant number that initiated the transaction, 8-10 digits

If the sub-merchant number 0 is a transaction under the general acceptance mode, display the merchant number of the contracted merchant, 8-10 digits

If it is a directly connected transaction, it is displayed as the number 0

Device number 8888 the information passed in the device_info field when the order was placed for the transaction is left blank if left blank.

Wechat order number 4200000008201712143733500001 the order number assigned by WeChat Pay for the order (or the order corresponding to the refund)

Merchant order number test1 the merchant order number of the order (or the order corresponding to the refund) passed by the merchant corresponds to the out_trade_no field in the API for issuing the order.

User ID the unique ID (openid) assigned by the testxt08c-XB5-QD208X1Aid0Cbs Wechat platform to the payment user under the public account (appid).

Transaction type NATIVE the transaction type of the order (or the order corresponding to the refund order), shown by acronym, value and meaning: value:

JSAPI-JSAPI pay (or Mini Program pay)

NATIVE-Native payment

APP-app payment

MWEB-H5 payment

MICROPAY- payment code payment

PAP- entrusted withholding

Transaction status SUCCESSSUCCESS- paid successfully, indicating that the data of the bank is a successful payment order

REFUND- is transferred to a refund, indicating that the data of the bank is a refund order that initiated a refund successfully.

REVOKED- has been cancelled, indicating that the data of the bank is a revocation order that has been successfully revoked.

Payment bank OTHERS bank type, using the bank ID of string type, such as CMC_CREDIT. For a complete description, please see https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=4_2

Currency type CNY currency type, a three-letter code that conforms to the ISO 4217 standard, such as CNY

Total amount 0.01 the payable amount of the order (= order amount-the amount of free vouchers used by the user). If the data of the order is a refund or cancellation, it will be displayed at 0.00 yuan per unit, reserved to 2 decimal places.

The amount of WeChat Pay vouchers (including top-up coupons and free vouchers) used in this order will be displayed at 0.00 yuan if the voucher is not used, or if the data is refunded or revoked. Unit yuan, reserved to 2 decimal places

Wechat refund order number 0 the refund order number assigned by WeChat Pay for the refund. If the data of the refund is an order, 0 will be displayed.

Merchant refund order number 0 the merchant refund order number filled in when the merchant initiates the refund, and displays 0 if the data is an order.

Refund amount 0.00 the settlement amount of the refund or cancellation order (refund amount applied for-refund amount of free vouchers), if the data is an order, it is displayed as 0.00, non-negative number, unit yuan, retained to 2 places after the decimal point

Voucher or deduction rebate amount 0.00 refund amount of refund coupons included in the refund amount, if the bank data is an order or no refund coupon refund is displayed as 0.00, non-negative number, unit yuan, retained to 2 decimal places

Refund type ORIGINAL- original refund

BALANCE- is transferred to the user's WeChat Pay change.

If the line data is an order, leave it blank

Refund status the status of the refund when the billing file is generated and will not be updated later. if the line data is an order, leave it blank.

SUCCES- refund successful

FAIL- refund failed M

PROCESSING- refund processing

Commodity name [body] the commodity name of the order (or the order corresponding to the refund) passed by the merchant corresponds to the body field in the API for issuing the order.

Merchant data packet test [attach] the merchant data packet of the order (or the order corresponding to the refund) passed by the merchant corresponds to the attach field in the API for issuing the order, leaving it blank when it is not passed

Handling fee 0.00000 the amount of handling fee corresponding to the order / refund, the order corresponds to a positive number, the refund corresponds to a negative number, unit yuan, 2 digits after the decimal point

The rate, percentage, such as 0.60%, used for billing the transaction.

Settlement statement after the opening of free vouchers

Field name sample value field description

Transaction time 2017-12-14 15:49:06 refers to the time when the transaction was paid successfully or when a refund was initiated (note: it is not a refund success time), in the format of YYYY-MM-DD HH:MM:SS, such as 2015-01-01 10:00:00

The appid,appid used by the public account IDwxab8acb865bb11234 when initiating the transaction is the unique identification assigned by the Wechat platform to the official account or app to distinguish the transaction scenarios.

Merchant number 1234567890 WeChat Pay merchant number that initiated the transaction, 8-10 digits

If the contracted merchant number 0 is a transaction under the general acceptance mode, display the merchant number of the contracted merchant, 8-10 digits

If it is a directly connected transaction, it is displayed as the number 0

Device number 8888 the information passed in the device_info field when the order was placed for the transaction is left blank if left blank.

Wechat order number 4200000008201712143733500001 the order number assigned by WeChat Pay for the order (or the order corresponding to the refund)

Merchant order number test1 the merchant order number of the order (or the order corresponding to the refund) passed by the merchant corresponds to the out_trade_no field in the API for issuing the order.

User ID the unique ID (openid) assigned by the testxt08c-XB5-QD208X1Aid0Cbs Wechat platform to the payment user under the public account (appid).

Transaction type NATIVE the transaction type of the order (or the order corresponding to the refund order), shown by acronym, value and meaning: value:

JSAPI-JSAPI pay (or Mini Program pay)

NATIVE-Native payment

APP-app payment

MWEB-H5 payment

MICROPAY- payment code payment

PAP- entrusted withholding

Transaction status SUCCESSSUCCESS- paid successfully, indicating that the data of the bank is a successful payment order

REFUND- is transferred to a refund, indicating that the data of the bank is a refund order that initiated a refund successfully.

REVOKED- has been cancelled, indicating that the data of the bank is a revocation order that has been successfully revoked.

Payment bank OTHERS bank type, using the bank ID of string type, such as CMC_CREDIT. For a complete description, please see https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=4_2

Currency type CNY currency type, a three-letter code that conforms to the ISO 4217 standard, such as CNY

Due order amount 0.01 the settlement amount of the order (= order amount-the amount of free vouchers used by the user). If the data in this line is a refund or cancellation, it will be displayed at 0.00 yuan, reserved to 2 decimal places.

The amount of WeChat Pay vouchers used in this order (including top-up coupons and free vouchers) is 0.00. if the voucher is not used, or if the data is refunded or revoked, it will be displayed at 0.00 yuan, reserved to 2 decimal places.

Wechat refund order number 0 the refund order number assigned by WeChat Pay for the refund. If the data of the refund is an order, 0 will be displayed.

Merchant refund order number 0 the merchant refund order number filled in when the merchant initiates the refund, and displays 0 if the data is an order.

Refund amount 0.00 the settlement amount of the refund or cancellation order (refund amount applied for-refund amount of free vouchers), if the data is an order, it is displayed as 0.00, non-negative number, unit yuan, retained to 2 places after the decimal point

Refund amount 0.00 refund amount of refund coupons included in the refund amount, if the bank data is an order or there is no refund of refund coupons, it will be displayed as 0.00, non-negative number, unit yuan, retained to 2 places after the decimal point.

Refund type ORIGINAL- original refund

BALANCE- is transferred to the user's WeChat Pay change.

If the line data is an order, leave it blank

Refund status the status of the refund when the billing file is generated and will not be updated later. if the line data is an order, leave it blank.

SUCCES- refund successful

FAIL- refund failed M

PROCESSING- refund processing

Commodity name [body] the commodity name of the order (or the order corresponding to the refund) passed by the merchant corresponds to the body field in the API for issuing the order.

Merchant data packet test [attach] the merchant data packet of the order (or the order corresponding to the refund) passed by the merchant corresponds to the attach field in the API for issuing the order, leaving it blank when it is not passed

Handling fee 0.00000 the amount of handling fee corresponding to the order / refund, the order corresponds to a positive number, the refund corresponds to a negative number, unit yuan, 2 digits after the decimal point

The rate, percentage, such as 0.60%, used for billing the transaction.

Order amount 0.01 the amount of the order, including the amount paid by the user, the amount of top-up coupons and the amount of free-recharge coupons, if the data is refund or cancellation, fill in 0.00, unit yuan, reserved to 2 places after the decimal point

Refund amount 0.00 the amount initiated by the merchant, including the amount returned to the user, the refund amount of the recharged coupon, the refund amount of the free refund coupon, if the bank data order, fill in 0.00, unit yuan, keep to 2 decimal places

Rate remarks if there is a special rate rule, it will be stated. Leave it blank by default.

Error code

Error code name describes the cause solution

The 20003SYSTEMERROR download failed and the system timed out. Please try to query again.

20001sign error signature error request parameter is not completed as required. Signature error, please check whether the parameter and signature key are correct

20001nonce_str too long parameter nonce_str error request parameter did not enter the required parameter nonce_str length is too long

20001invalid tar_type, Only GZIP supported parameter tar_type error request parameter is not entered according to the guidelines, please check whether the parameter invalid tar_typ is correct

20001invalid bill_type parameter bill_type error request parameter is not entered according to the guidelines please check whether the parameter bill_type is correct

20001invalid bill_date parameter bill_date error request parameter is not filled in according to the guidelines please check whether the parameter bill_date meets the requirements

20001require POST method request method error request method does not meet the requirements check whether the parameter request mode is post

20001empty post data request message error request message is empty please re-check whether the request message is correct

20001data format error parameter format error request parameter is required to be in xml format please check whether the request parameter format is xml

20001missing parameter missing parameters. Required parameters are not uploaded. Please re-check whether all required parameters have been uploaded and are not empty.

20001invalid appidappid error request parameter appid is incorrect. Please check again whether the parameter appid is correct.

20001invalid parameter parameter error has unknown request parameters. Please re-check whether all parameters match the document.

20001sub_mch not allow merchant number permission error there is no permission to download the merchant bill. Please check whether the merchant number is correct. If you are a small and micro merchant, you can not send sub_mch_id to get the bill of all the contracted merchants.

20002NO Bill Exist bill does not exist for which the current merchant does not have a completed order. If a statement is not generated, please check whether the current merchant has a successful transaction within the specified date.

20002Bill Creating bill is not generated. No completed order or statement has not been generated. Please check whether there is a successful transaction on the specified date. If there is a transaction on the specified date, the bill is in the process of being generated. Please download it after 10:00

20007 current merchant billing API permission has been turned off. Current merchant billing API permission has been closed. Current merchant billing API permission has been turned off. Current merchant billing API permission has been turned off. Please contact WeChat Pay to solve the problem.

The 20100system error download failed and the system timed out. Please try to query again.

The above is all the contents of this article entitled "how to use CloudPay.downloadBill () in Wechat Development". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report