Reputation: 2913
Hey guys for my website I am trying to figure out how to make an automated paypal shop, what I mean by that is when they purchase membership via paypal by clicking a paypal button on my website it will also change a value inside of my database for that specific user.
So in a timeline fashion:
Currently All I need help on is how to make it automatically redirect after the payment is complete. I followed some code but it still didn't work, here is what I'm using.
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<!-- Identify your business so that you can collect the payments. -->
<input type="hidden" name="business" value="MY EMAIL">
<!-- Specify a Buy Now button. -->
<input type="hidden" name="cmd" value="_xclick">
<!-- Specify details about the item that buyers will purchase. -->
<input type="hidden" name="return" value="MY URL TO REDIRECT TO">
<input type="hidden" name="item_name" value="Sponsored (1 Month)">
<input type="hidden" name="amount" value="0.01">
<input type="hidden" name="currency_code" value="NZD">
<!-- Display the payment button. -->
<input type="image" name="submit" border="0"
src="https://www.paypal.com/en_US/i/btn/btn_buynow_LG.gif"
alt="PayPal - The safer, easier way to pay online">
<img alt="" border="0" width="1" height="1"
src="https://www.paypal.com/en_US/i/scr/pixel.gif" >
</form>
That code leaves you at the Paypal "payment complete" page, but I want it to automatically go to the return url on payment complete.
Upvotes: 0
Views: 313
Reputation: 91
Is your return url really "MY URL TO REDIRECT TO" or is it something like "http://myURL.com/myPage.asp"? The first one wouldn't work, obviously.
Upvotes: 0
Reputation:
that's not how paypal works, you can't rely on the visitors return, you use the IPN (Instant Payment Notification) feature of paypal, read its docs on how this works.
Instant Payment Notification - PayPal
Upvotes: 1