Some time ago, I helped a friend add the WeChat scan payment function to the mall developed based on ecshop. I thought it was a very simple matter - download the official sdk or development help document, follow the instructions in it and it will be ok. Who knew it would be a hassle? 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 briefly described how they developed the access, and did not solve the problems I encountered... , Alas, sometimes I really feel that I can only rely on myself. 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: First The QR code can still be scanned normally after scanning the QR code for the first time. Scanning again without payment 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 anyone who knows can help. Give me the answer, thank you!
△Mode 2:
Note: cannot directly use the mall’s order number as the transaction order number (out_trade_no), otherwise the WeChat scan code payment QR code will be generated again , the interface will prompt: The merchant order number is duplicated and cannot be regenerated.
Then 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 ordering interface before scanning the code, out_trade_no does not pass in the order number of the mall order system, but regenerates a new unique flow; add another order number corresponding to the WeChat payment transaction order number (out_trade_no) The table is as follows:
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 check the order payment status, you must know it too ...
, I have n’t written a technical blog and I ca n’t find the feeling for a long time. The writing may be rough. Pay attention & communicate!
Reference website>>
Ecshop WeChat payment plug-in.rar
My WeChat subscription number: zxcknowmore
, your attention and support enable me to write more Blog post motivation!🎜 🎜 The above introduces how thoughts determine how far you can go! Follow your inner voice and stay firm in the direction you want to move forward, including some content. I hope it will be helpful to friends who are interested in PHP tutorials. 🎜 🎜 🎜