WeChat Payment API v3 Callback Notification Signature Verification Is there a PHPdemo?
Detailed problem introduction:
##Return the wechatpay-signature field received by WeChat callback Signature verification failed. Later, the interruption point found that
decoded the wechatpay-signature field received by the WeChat callback with base64_decode to get the garbled code,
What's the problem? The callback fails to verify the signature. The problem is urgent! ! !
The certificate used for confirmation is the platform certificate, which is also the latest one.
Solution:
Problem solved! ! !
My problem is because I used the framework's method of obtaining parameters in the body, which caused the order of the fields in the body parameters to be inconsistent with what was sent from WeChat. (I was inspired by reading an article about Java implementation. ), it is strongly recommended to use the native programming language to obtain parameters. Our php is file_get_contents("php://input");
Note: After decoding the WeChat signature base64_decode, it is garbled. This is not WeChat's. The signature is wrong, that’s how it is originally
Anyway, to rule out issues such as certificates and serial numbers, it depends on the parameters
Comments are adjusted This is the way I originally obtained the parameters and constructed the signature string. Now I use the native method to verify it.
I hope it can help everyone.
The above is the detailed content of How to solve the problem of garbled characters in WeChat payment API v3 callback notifications. For more information, please follow other related articles on the PHP Chinese website!