0

I am going through this tutorial. I want to redirect the page on successful payment using the success handler but I also want to be sure that the payment was successfully processed, which happens by a post back, explained here

I am not sure how to make it synchronously, which means redirect to my controller only after the post back is called by Google! Also, how do I test post back with localhost?

Or is there a method which I can call on Google API which will give me status of the transaction?

---EDIT---

I wonder, if google wallet popup only shows success after calling the post back. Even if that's true how do I test it with localhost?

Sap
  • 5,197
  • 8
  • 59
  • 101

1 Answers1

0

Documentation you linked should already answer your question -

  • You will get a postback (and a success callback result in client side) if Google successfully processed the payment - "If you want to make sure that the buyer has paid for the item, you should specify a postback URL. If you do, Google sends an HTTP POST message to the postback URL whenever a purchase completes. Your server needs to acknowledge these POST messages, or else the transactions will be canceled. See here.
  • Unsure what you meant by "synchronous" - there is a success and failure callback (client side) that you will write/handle given a result...
  • You cannot use localhost to handle the callback from Google - your handler must be on a public facing server reachable by public DNS (the callback request comes from Google - the context of localhost will obviously be their server).
  • the (modal) popup is persistent until either your success or failure client script "takes over" and does what you want it to do
    • note: if your server doesn't handle the callback, Google will display error to the user/buyer as mentioned above....

Hth....


Additional reference: see this SO answer - which provides more info on what you can expect from as a RESULT from Google (during payment processing).

Community
  • 1
  • 1
EdSF
  • 11,753
  • 6
  • 42
  • 83
  • I understand your first point but my question is that I want to make sure that paymey is processed before I redirect to my Download page. So the question phrased differently "Is it guaranteed that google callback will always be called before the JS success handler?" Second, I totally understand I can't use localhost, but if I can't then how do I do the development? – Sap Jun 03 '13 at 05:57
  • @Sap - I've modified the answer to be more concise, I left out a section that should clarify re: if the payment fails, the callback result is a failure (client side). Your failure handler should then handle. Debugging: you can use your existing public server to handle sandbox (a setting in the Google Javascript) and/or dedicate a url on your server for debugging (e.g. /debug vs. /live). – EdSF Jun 03 '13 at 14:49
  • link is no longer working – Parzival May 16 '23 at 01:14