Recently made a new mall project , Wechat is used for payment h5 payment ,h5 The order status cannot be queried during payment , Cause payment failure , Status acquisition is not timely when payment is successful or cancelled , The user returns from the wechat payment interface app The middle page is not refreshed. There is a white screen problem .
1. Find information :
From the information on the official website, wechat h5 Payment has a callback address , need h5 Write the corresponding logic according to the order status , And our H5 The classmate did not add this callback address , Then send him the document , According to this access callback address , However, it is found that there will still be a short white screen page when paying , Whether payment fails or succeeds , The cancellation interface was not refreshed , After investigation, it was found that although h5 The classmate added the callback address , However, the corresponding logic is not processed according to the order status , Because the project is in a hurry to go online , and H5 The students said they couldn't handle it , No way, only App This way .
2. Ideas for solving problems :
stay App Medium tune up WeChat H5 Set a variable whether it is wechat payment during payment , Then intercept the callback address “redirect_url”, Cancel user payment , Failure and success return App Take the initiative to refresh the interface , Equivalent to h5 The query status refresh interface writes the corresponding logic App.
a. The core logic is to intercept the callback address , The screenshot is as follows :
b. set up isWxPay by true
c. User payment cancellation , fail , Successful return App Refresh interface when :
3. Pass above 3 This step can be well solved App Call wechat H5 Refresh problem during payment , This scheme has been put into practice in the project , however h5 Why not refresh in time , I don't know that the corresponding logic is not handled in time after obtaining the callback address , Due to project reasons , and iOS Solve the problem by themselves through unified consultation , There is no question of who will deal with it , I hope it will be helpful to my friends .
Technology
Daily Recommendation