Payment scan code payment development: the pitfalls and solutions I encountered (Appendix: Ecshop payment plug-in), ecshop
Some time ago, I helped a friend's ecshop-based mall to add the scanning and payment function. I thought it was a very simple thing-download the official sdk or development help documentation and press the instructions in it to get it done, who knows that it takes two or three days to get it done? I also found a lot of technical articles on the Internet with questions, but I found that they only roughly wrote how they developed and accessed them, the problem I encountered was not solved ..., alas, sometimes you really feel that you can only rely on yourself '. This article is intended to write out the problems and solutions you have encountered, so that developers can help you with this aspect!
Before development, check the official development document scan payment. Scan payment is divided into the following two modes:
△Mode 1:
Problem: the first scan of the QR code can still be normal scan, the next scan will prompt: OK or request the merchant information timeout HttpCode is not 200 -- this problem cannot be solved by any means. Here, I hope some friends can answer it. Thank you!
△Mode 2:
Note:You cannot directly use the order number of the mall as the transaction order number (out_trade_no). Otherwise, when the QR code is generated again, the interface will prompt that the merchant's order number is repeated and cannot be regenerated.
How can I set the transaction order number to ensure that the corresponding order information in the merchant's platform can be queried or reconciliation can be realized through the interface later? The feasible method is: the unified order interface before scanning the code, out_trade_no should not be passed into the Order Number of the mall order system, but re-generate a new unique flow; add another table corresponding to the order number and the payment order number (out_trade_no), as shown below:
In the above table, there is a serial_is_paid field: used to mark whether the transaction has been completed, that is, in the callback processing of the successful payment notification, the payment status is updated based on the out_trade_no returned; as to how to query the order payment status, you should have known it too...
Well, if you haven't written a technical blog for a long time, you may not be able to find the feeling. You may write it roughly. If you have any questions, you can pay attention to and communicate with others!
Reference website>
Ecshoppayment plug-in .rar
My subscription number:ZxcknowmoreYour attention and support are the motivation for writing more blog posts!