search
HomeWeChat AppletWeChat DevelopmentHow to solve the problem of garbled characters in WeChat payment API v3 callback notifications

WeChat Payment API v3 Callback Notification Signature Verification Is there a PHPdemo?

Detailed problem introduction:

How to solve the problem of garbled characters in WeChat payment API v3 callback notifications

How to solve the problem of garbled characters in WeChat payment API v3 callback notifications

##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,

How to solve the problem of garbled characters in WeChat payment API v3 callback notifications

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

How to solve the problem of garbled characters in WeChat payment API v3 callback notifications

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!

Statement
This article is reproduced at:Newzers. If there is any infringement, please contact admin@php.cn delete

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)