I have a custom built shopping cart th开发者_如何学JAVAat is double charging clients credit card when they click the back button. My thought is to make them shopping cart empty when they click the back button. Any ideas will be highly appreciated.
There are multiple ways to solve this problem:
Your form passes a unique GUID as a hidden form field on the submission page. Then your app stores this GUID in the session object on the server. Before you process the payment, you can check to see if this value is already stored in the session.
Your application is not responsible for processing orders... only storing order info in a database. Another application daemon on the server looks for orders waiting to be processed on the server and processes them offline. Advantage here is you won't have HTTP timeout problems, as well as avoiding the refresh problem.
Post/Redirect/Get
精彩评论