This article is a mirror article of machine translation, please click here to jump to the original article.

View: 12307|Reply: 2

Some problems with Alipay payment asynchronous callback

[Copy link]
Posted on 12/6/2018 7:22:08 PM | | | |
I have done Alipay payment many times, but I still often fall into the pit, so I will sort it out now for reference

1. About setting the public key



Be sure to pay attention to the "Alipay public key", do not fill in the application public key, otherwise you will be pitted

2. The domain name address of the callback

Clean, don't have parameters, such as: http://*****.com/notify.php, don't write: http://*****.com/back.php?r=notify.

This attention is for using the framework, you must beautify the URL, otherwise you will directly use the one with parameters, and the callback will put "? If all the following parameters are removed, then the actual callback function will definitely not be accessible, it can only be the home page or something like that.



3. Pay attention to setting the callback domain name settings

This callback is an application gateway, not an authorized callback address.

4. About the parameters containing Chinese

Alipay callbacks are given directly in Chinese, without coding. When I record the log, I code it and put it in the log, so I directly use the signature tool to verify the content of the log, and it doesn't pass. So just use the default no encoding in the demo, don't encode Chinese. (I use PHP, if it is java Chinese, I need to handle it myself)


5. The last one is to warn yourself

Be sure to read the parameters clearly and do not scribble. The order ID parameter of the callback is "out_trade_no" is not "orderid", the amount is "total_amount" not "money", because multiple payment interfaces are written at once, so the callback verification is a public function, directly copied, without paying attention, and the result is a waste of hours on this. Pay attention to this in the future.


There are also some things to note, such as: the signature method is "RSA2", the encoding is "UTF-8", etc., the demo has defaults, just don't move it unless necessary. If you don't need a demo, pay attention to these.


Synchronous return processing (return_url): It is a visual return, IE page jump notification, as long as the payment is successful, Alipay jumps to this address through the get method, and has parameters to this page. Customer acquisition information is influenced by customer actions. If the buyer pays in full
After completion, the customer server responds slowly, and the buyer closes the page when the Alipay prompt "instant payment successful", then the customer website cannot obtain information, which is called "dropped order" on our side. Moreover, this return processing is a one-time call, that is, the synchronous return processing is called after the payment is successful.
Asynchronous return processing (notify_url): Its data interaction is through data interaction between servers, which must be placed on the server (public network) for testing, and the server posts messages to the asynchronous return processing page, which requires customer technology to process related data processing on the asynchronous return processing page
, and then each step must be returned to Alipay success (cannot contain other HTML scripting languages, and cannot do page jumping. If this return processing is OK, then there will be basically no order drop, because Alipay will return the order information in 6~10 times within 24 hours
to the customer website until Alipay captures success.
Note: Synchronous return processing is affected by buyer actions:
If the buyer is in operation, Alipay enters the Alipay prompt success page after completing the operation, at this time because the server is correspondingly slow, then the buyer may close this page, at this time you will not be able to accept the information returned by Alipay, and some online banking will not call up Alipay's synchronous return after payment
Go back to the processing page, so that you can't accept the data when you are doing data processing synchronously.







Previous:Run node hint :events.js: 160 throw er; // Unhandled 'error' event
Next:German Literature, PDF, many g
 Landlord| Posted on 12/6/2018 7:40:44 PM |
A server notification, the corresponding parameter is notify_url, and Alipay notification uses the POST method
Page B jumps to the notification, the corresponding parameter is return_url, and Alipay notification uses the GET method
Posted on 12/9/2018 6:03:14 PM |
Official website document link:https://docs.open.alipay.com/270/
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com