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

An example Analysis of the Development of WeChat Pay Customs Declaration Interface on Wechat Public platform

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article mainly shows you the "example analysis of the development of WeChat Pay customs declaration interface on Wechat public platform". The content is simple and clear. I hope it can help you solve your doubts. Next, let the editor lead you to study and learn the article "example Analysis of developing WeChat Pay Customs Declaration Interface on Wechat Public platform".

Customs declaration interface API interface address https://api.mch.weixin.qq.com/cgi-bin/mch/customs/customdeclareorder

Is a certificate required?

I don't need it.

Request method: post data format: xml signature method: MD5

Note: the amount of the merchant's order number is based on the amount recorded in the payment system and does not need to be uploaded. If you have a sub-order number, you must upload the amount payable for the sub-order, logistics fee and commodity price (amount payable = logistics fee + commodity price).

Field name variable name required type sample value indicates that the signature sign is a String (32) C380BEC2BFD727A4B6845133519F3AD6 signature For details, see signature generation algorithm Public account IDappid is String (32) wxd678efh667hg6787 Public account assigned by Wechat ID merchant number mch_id is String (32) 1230000109 merchant number assigned by WeChat Pay merchant number out_trade_no is String (32) 20150806125346 order number within the merchant system WeChat Pay order number transaction_id is String (28) 1000320306201511078440737890 Customs order number returned by WeChat Pay is String (32) SHANGHAI

NO does not need to be reported to the customs

GUANGZHOU Guangzhou

HANGZHOU Hangzhou

NINGBO Ningbo

ZHENGZHOU_BS Zhengzhou (bonded Logistics Center)

CHONGQING Chongqing

XIAN Xi'an

SHANGHAI Shanghai

ZHENGZHOU_ZH Zhengzhou (Comprehensive Insurance Zone)

SHENZHEN Shenzhen

Merchant Customs record number mch_customs_no No String (32) 123456 the record number of the merchant registered with the customs, customs is not NO, this parameter must be filled in duty No Int888 tariff, divided into units the following fields must be passed when opening the order or re-declaring

Field name variable name required type sample value describes the merchant sub-order number sub_order_no No String (32) 20150806125346 merchant sub-order number, if there is an order, the currency must be passed fee_type No String (3) CNY the currency used when paying the order, only RMB CNY is supported for the time being, and must be passed if there is an order to be opened. Amount payable order_fee No Int888 sub-order amount, divided into units, can not exceed the original order amount, order_fee=transport_fee+product_fee (amount payable = logistics fee + commodity price), if there is an order must be passed. Logistics fee transport_fee no Int888 logistics fee, divided into units, if there is an order must be passed. Commodity price product_fee no Int888 commodity fee, divided into units, if there is an open order, it must be passed. The following fields must be passed when Wechat lacks user information. If the merchant uploads the user information, the information uploaded by the merchant shall prevail.

Field name variable name required type sample value description document type cert_type No String (32) IDCARD only supports ID card for the time being. This parameter refers to user information. If the merchant has user information, it can be uploaded. The system will apply for customs clearance based on the data uploaded by the merchant. ID No. Cert_ id string (64) 330821198809085211 ID card number. This parameter refers to the user information. If the merchant has the user information, the system will apply for customs clearance based on the data uploaded by the merchant. Name nameString (64) Zhang San user name, this parameter refers to the user information. If the merchant has user information, the system will apply for customs clearance based on the data uploaded by the merchant. Examples are as follows:

Wx2421b1c4370ec43b ZHENGZHOU_BS D00411 1262544101 13110 15112496832609 13110 8FF6CEF879FB9555CD580222E671E9D4 1006930610201511241751403478 0 CNY 15112496832609001 Note: parameter values can be escaped with XML, and the CDATA tag is used to indicate that the data is not parsed by the XML parser.

Answer parameter list field name variable name required type sample value description return status code return_code is String (16) SUCCESS

SUCCESS/FAIL

This field is a communication ID, not a transaction ID. You need to check result_code to determine whether the transaction is successful or not.

Return message return_ msg No string (128) signature failed

Return information. If it is not empty, it is the error reason.

Signature failed

Parameter format check error

The following fields are returned when return_code is SUCCESS

Field name variable name required type sample value description signature type sign_type is String (32) MD5 only supports MD5 signature sign is String (32) C380BEC2BFD727A4B6845133519F3AD6 signature For more information, see signature generation algorithm Public account IDappid is String (32) wxd678efh667hg6787 Public account assigned by Wechat ID merchant number mch_id is String (32) 1230000109 WeChat Pay assigned merchant number business result result_code is String (16) SUCCESSSUCCESS/FAIL error code err_ code negative string (32) SYSTEMERROR see error list error code description err_code_ de No string (128) system error description the following fields Return when both return_code and result_code are SUCCESS

Field name variable name required type sample value description status code state is String (2) UNDECLARED

Status code

UNDECLARED-undeclared

SUBMITTED-the declaration has been submitted (the order has been sent to the customs, the merchant has re-declared, and the customs has a modification interface, so the status of the record will be this)

PROCESSING-in declaration

SUCCESS-successful declaration

Failed to declare FAIL--

EXCEPT-Customs interface exception

WeChat Pay order number transaction_id is String (28) 100032062015178440737890 the order number returned by WeChat Pay out_trade_no is String (32) 20150806125346 merchant sub-order number sub_order_no No String (32) 20150806125346 merchant sub-order number, if there is an order, you must send the WeChat sub-order number sub_order_id No String (32) 20150806125346 WeChat sub-number modify_time is the last update time String (14) 20091227091010 The format is yyyyMMddhhmmss, as expressed as 20091227091010 at 09:10:10 on December 27th, 2009. The time zone is GMT+8 beijing. This time is taken from Wechat server error code name description reason solution 132011004 parameters error declaration only pass in the order number, do not enter the sub-order number (sub_order_no), can not fill in the cost information, must be based on the value in the payment system please check whether all the parameters are correct 132021028 the transaction currency is not consistent with the merchant settlement currency] when you enter the sub-order number (sub_order_no) during customs declaration Currency parameter (fee_type) is required Please check whether the passed currency parameter (fee_type) is empty MCHID_NOT_SET merchant number is not set as required parameter When requesting, please check whether the merchant number is empty MCHID_INVALID_LENGTH invalid merchant number length declaration interface only supports 10 digits at the beginning of 12, please check whether the merchant number length is 10 digits CUSTOMSCONFIG_NOT_SET customs configuration does not set the customs declaration interface requires the merchant has configured customs information to access, please refer to the customs filing guidelines above, if the FEETYPE_NOT_SET currency type is not set to open the order Currency is required Please check whether fee_type is empty OUTTRADENO_NOT_SET Merchant order number (out_trade_no) not set Merchant order number is required Please check Merchant order number (out_trade_no) empty TRANSACTION_ID_NOT_SET Wechat order number (transaction_id) not set Wechat order number (transaction_id) is required Please check whether Wechat order number (transaction_id) is empty INVALID_ Invalid Wechat order number length of TRANSACTION_ID Wechat order number is 28 digits Please ensure that the length is the same please check whether the Wechat order number (transaction_id) is correct CUSTOMS_NOT_SET customs information is not set as a required field please check whether the customs information is empty CHCUSTOMSNO_NOT_SET customs record number is not set as a required field please check whether the record number is empty INVALID_MCHCUSTOMSNO invalid customs record number length Customs record number is usually a 6-digit string Whether the record number is correct PAYFEE_NOT_MATCH amount does not match the amount of customs declaration must be the same as the amount paid please check whether the amount of the declaration order is correct INVALID_SUBORDER_NO invalid sub-order number length (sub_order_no) sub-order number requirement is less than 32-digit string please check whether the sub-order number length is correct APPID_NOT_EXISTAppId is not set (sub_order_no) appid is a required field Check whether appid is correct MCHID_NOT_EXIST merchant number (mch_id) MCH_ID is not set as a required field please check whether mch_id is correct AUTHORITY_NOT_FOUND does not enable self-clearance function must activate self-clearance function before you can successfully call the API please check whether self-clearance function has been enabled Opening path: WeChat Pay merchant platform-product center-self-service customs clearance application. NO_AUTH does not have the permission to call this API. Please check whether the current merchant has obtained the call permission to this API. 2. SDK implementation

Sdk definition

Third, the mode of call

3. Return the result

The data is sent as follows

Array (6) {["appid"] = > string (18) "wxa8092dd025e45123" ["mch_id"] = > string (10) "1238298123" ["out_trade_no"] = > string (22) "SH20160824095750086988" ["transaction_id"] = > string (28) "4006742001201608242098415582" ["customs"] = > string (6) "NINGBO" ["mch_customs_no"] = > string (10) "3302461123"}

The data received is as follows

Array (12) {["return_code"] = > string (7) "SUCCESS" ["return_msg"] = > string (6) "success" ["sign"] = > string (32) "91EFCEEAAD4322F331F3F63C4D8F1279" ["appid"] = > string (18) "wxa8092dd025e45123" ["mch_id"] = > string (10) "1238298123" ["result_code"] = > string (7) "SUCCESS" ["err_code"] = > string (1) 0 "[" err_code_des "] = > string (2)" OK "[" state "] = > string (9)" SUBMITTED "[" transaction_id "] = > string (28)" 4006742001201608242098415582 "[" out_trade_no "] = > string (22)" SH20160824095750086988 "[" modify_time "] = > string (14)" 20160825111049 "} above are all the contents of the article" example Analysis of developing WeChat Pay Customs Declaration Interface on Wechat Public platform " 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: 211

*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