search
HomeBackend DevelopmentPHP TutorialWeChat payment scan code payment development: pitfalls I encountered and solutions (attached: Ecshop WeChat payment plug-in), ecshop_PHP tutorial

Development of scan code payment for WeChat payment: pitfalls I encountered and solutions (attached: Ecshop WeChat payment plug-in), ecshop

Helped a friend some time ago The mall developed based on ecshop added the WeChat scan payment function. I thought it would be a very simple matter - download the official sdk or development help document and follow the instructions in it. Who knows that it took two or three days to get it done? , I also looked for a lot of technical articles on the Internet with questions, but found that they only wrote roughly how they developed the access, and did not solve the problems I encountered... Alas, sometimes I really feel 'You can only rely on yourself'. The purpose of this article is to write down the problems and solutions I encountered, so that friends who develop in this area can be helpful!

Before development, please check the official [Scan QR code payment] development document. Scan QR code payment is divided into the following two modes:

 △Mode 1:

 Problems encountered: The first scan of the QR code can still be scanned normally, but if you scan again without payment, it will prompt: ok or the request for merchant information has timed out and the HttpCode is not 200——I have tried to find a solution through various channels to no avail. I hope someone who knows can give me an answer. Thank you!

 △Mode 2:

 Note: You cannot directly use the mall’s order number as the transaction order number (out_trade_no), otherwise the WeChat scan code payment number will be generated again When entering the QR code, the interface will prompt: The merchant order number is repeated and cannot be regenerated.

So here comes Jiang Zi’s question, how should I set the transaction order number and ensure that the corresponding order information in the WeChat merchant platform can be queried through the interface later or reconciliation can be achieved? The feasible method is: use the unified order interface before scanning the QR code. Instead of passing in the order number of the mall order system for out_trade_no, regenerate a new unique flow; add another order number corresponding to the WeChat payment transaction order number (out_trade_no). Table, as follows:

WeChat payment scan code payment development: pitfalls I encountered and solutions (attached: Ecshop WeChat payment plug-in), ecshop_PHP tutorial There is a serial_is_paid field in the above table: used to mark whether this transaction has been completed, that is: in the payment success notification callback processing, the payment status is updated according to the returned out_trade_no; as for how to query the order payment Status, I think you should also know...

Okay, I have n’t written a technical blog that I ca n’t find my feelings for a long time. The writing may be rough. If you have unclear friends, you can pay attention to & communication! WeChat payment scan code payment development: pitfalls I encountered and solutions (attached: Ecshop WeChat payment plug-in), ecshop_PHP tutorial

Reference website>>

Ecshop WeChat payment plug-in.rar

My WeChat subscription account:

zxcknowmore, your attention and support are the motivation for me to write more blog posts!

http://www.bkjia.com/PHPjc/1048740.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1048740.htmlTechArticleWeChat payment scan code payment development: pitfalls I encountered and solutions (attached: Ecshop WeChat payment plug-in) , ecshop Some time ago, I helped a friend’s mall developed based on ecshop to add WeChat scanning...
Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Dependency Injection in PHP: Avoiding Common PitfallsDependency Injection in PHP: Avoiding Common PitfallsMay 16, 2025 am 12:17 AM

DependencyInjection(DI)inPHPenhancescodeflexibilityandtestabilitybydecouplingdependencycreationfromusage.ToimplementDIeffectively:1)UseDIcontainersjudiciouslytoavoidover-engineering.2)Avoidconstructoroverloadbylimitingdependenciestothreeorfour.3)Adhe

How to Speed Up Your PHP Website: Performance TuningHow to Speed Up Your PHP Website: Performance TuningMay 16, 2025 am 12:12 AM

ToimproveyourPHPwebsite'sperformance,usethesestrategies:1)ImplementopcodecachingwithOPcachetospeedupscriptinterpretation.2)Optimizedatabasequeriesbyselectingonlynecessaryfields.3)UsecachingsystemslikeRedisorMemcachedtoreducedatabaseload.4)Applyasynch

Sending Mass Emails with PHP: Is it Possible?Sending Mass Emails with PHP: Is it Possible?May 16, 2025 am 12:10 AM

Yes,itispossibletosendmassemailswithPHP.1)UselibrarieslikePHPMailerorSwiftMailerforefficientemailsending.2)Implementdelaysbetweenemailstoavoidspamflags.3)Personalizeemailsusingdynamiccontenttoimproveengagement.4)UsequeuesystemslikeRabbitMQorRedisforb

What is the purpose of Dependency Injection in PHP?What is the purpose of Dependency Injection in PHP?May 16, 2025 am 12:10 AM

DependencyInjection(DI)inPHPisadesignpatternthatachievesInversionofControl(IoC)byallowingdependenciestobeinjectedintoclasses,enhancingmodularity,testability,andflexibility.DIdecouplesclassesfromspecificimplementations,makingcodemoremanageableandadapt

How to send an email using PHP?How to send an email using PHP?May 16, 2025 am 12:03 AM

The best ways to send emails using PHP include: 1. Use PHP's mail() function to basic sending; 2. Use PHPMailer library to send more complex HTML mail; 3. Use transactional mail services such as SendGrid to improve reliability and analysis capabilities. With these methods, you can ensure that emails not only reach the inbox, but also attract recipients.

How to calculate the total number of elements in a PHP multidimensional array?How to calculate the total number of elements in a PHP multidimensional array?May 15, 2025 pm 09:00 PM

Calculating the total number of elements in a PHP multidimensional array can be done using recursive or iterative methods. 1. The recursive method counts by traversing the array and recursively processing nested arrays. 2. The iterative method uses the stack to simulate recursion to avoid depth problems. 3. The array_walk_recursive function can also be implemented, but it requires manual counting.

What are the characteristics of do-while loops in PHP?What are the characteristics of do-while loops in PHP?May 15, 2025 pm 08:57 PM

In PHP, the characteristic of a do-while loop is to ensure that the loop body is executed at least once, and then decide whether to continue the loop based on the conditions. 1) It executes the loop body before conditional checking, suitable for scenarios where operations need to be performed at least once, such as user input verification and menu systems. 2) However, the syntax of the do-while loop can cause confusion among newbies and may add unnecessary performance overhead.

How to hash strings in PHP?How to hash strings in PHP?May 15, 2025 pm 08:54 PM

Efficient hashing strings in PHP can use the following methods: 1. Use the md5 function for fast hashing, but is not suitable for password storage. 2. Use the sha256 function to improve security. 3. Use the password_hash function to process passwords to provide the highest security and convenience.

See all articles

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

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool