Link to home
Start Free TrialLog in
Avatar of DanielAttard
DanielAttardFlag for Canada

asked on

Complete javascript after call to PayPal

What is the best way to implement a call to PayPal so that after a customer completes the payment process, they are then directed back to the original site where the rest of the javascript can continue?

Perhaps I am not even thinking of this problem in the right terms  Basically I want some javascript code to run, but only after a successful PayPal payment has been completed.

Here is the code for the call to PayPal:

<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
  <input type="hidden" name="cmd" value="_s-xclick">
  <input type="hidden" name="hosted_button_id" value="123456789">
  <input type="image"
      src="https://www.paypalobjects.com/en_US/i/btn/btn_paynow_SM.gif"
      border="0" name="submit"
      alt="PayPal - The safer, easier way to pay online!">
  <img alt="" border="0"
      src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1"
      height="1">
</form>

Open in new window


Any ideas or best practices for me to consider?  Thanks.
Avatar of leakim971
leakim971
Flag of Guadeloupe image

when you create your form(button) with paypal, you have the possibility to set this URL in the step two.
You can use the same url/page and add a parameter in the url
or use a different page
ASKER CERTIFIED SOLUTION
Avatar of Andrew Angell
Andrew Angell
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of DanielAttard

ASKER

Great points angelleye.  I hadn't thought about the possibility of the user not making it to the return URL.  In my particular use-case, I absolutely need my javascript code to run at the moment the payment is processed on PayPal.  I will start reading-up on IPN.
Thanks.