The message "errmsg chooseWXPay fail" and "choosewxpayerrmsg" is returned when the WeChat official account is called for payment.

Source: Internet
Author: User

The prompt "errmsg chooseWXPay fail" and choosewxpayerrmsg is displayed when the Public Account calls choosewxpay.

Public account payment has been prompted "errmsg choosewxpay fail", there is no specific error message, the signature is no problem (Signature Verification address: https://pay.weixin.qq.com/wiki/doc/api/micropay.php? Chapter = 20_1), there is no problem with the payment directory settings, because the provided sdk is used, and all focuses on the sdk specific process, we found the original encryption algorithm used by the sdk signature.

According to the payment business process, there are two main steps: 1. The background calls the unified order interface to obtain the prepay_id, 2. the frontend calls the js function chooseWXPay to pull up the payment. signature is required for both processes.

Sdk: https://pay.weixin.qq.com/wiki/doc/api/micropay.php? Chapter = 11_1. the java sdk is used. By default, HMACSHA256 is used to call unified order interface encryption. The front-end js uses the chooseWXPay encryption algorithm to only support MD5, if the two encryption algorithms are inconsistent, the system prompts the error message "errmsg choosewxpay fail". I do not know whether the two encryption algorithms are related or not.

In the sdk file WXPay. java, the default value is HMACSHA256, Which is changed to MD5 to call the payment interface.

 

Later, based on the cause of the error, I checked whether other students found this problem, such as invalid choosewxpay fail and signature error, signature errors and payment directory settings are found.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.