Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Checkout : Best way to handle cart editing and checkout confirmation

I am in the process of implementing Google Checkout in an e-store. Once customers click the 'Google Checkout' button, my project requires that they are able to navigate back to the e-store to possibly edit the cart. Customers should be able to click the 'back' button, type in the URL to my cart page, or click the 'edit' link from Google.

At the same time, I need to clear the cart and provide customers with a blank slate as soon as they click the confirmation button on Google's side. I am already listening for a new-order-notification from Google, but this does not always arrive quickly enough to prevent customers from returning to the e-store and scratching theirs heads as to why their carts still show the items they just purchased.

Have any Google Checkout implementors come up with a novel solution to this problem? Any ideas are appreciated!

like image 293
AndreiM Avatar asked Nov 14 '22 16:11

AndreiM


1 Answers

I've done this using 2 different approaches, neither properly fulfils your requirement of handling the back button AND clearing the basket if they complete the order, but they've worked for me in practice without any complaints.

First approach: clear the basket and provide way of reconstructing it via query string in the "EditCartUrl" Google Checkout request parameter. Then, when the customer clicks the edit basket button their basket is reconstructed. The back button, however, does not work in this situation.

Second approach: don't clear the basket, but (optionally) make it read-only before redirecting to Google Checkout. We do this so that the basket record cannot be changed while they are within Google Checkout. If they then click back, or edit cart, a NEW basket is created on our site (cloned from the original) each time. This provides support for the back button, but will only provide the customer with a cleared basket if the order has gone through and we have processed the request before they return to the site.

Making the basket read-only is optional - we do it so we can preserve the basket record to match the resulting order from Google Checkout. If you don't require this, it's as simple as not clearing the basket.

The second approach has done me fine for the last few years without any complaints from customers. I'd rather the customer be able to click the back button than worry too much about them seeing the basket not empty itself after checking out using Google.

like image 173
David Duffett Avatar answered May 26 '23 06:05

David Duffett