Question

I have used "Subscribe" Button in one of my application as below:

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

@MyUserID is the identity value of my inserted entry to track the transaction and will update the same record when we come back to our site.

Now, I want to insert the transaction entry in the database to track it when we come back to our site. so at which place should I insert the database and how.?

Was it helpful?

Solution

How are you populating the custom value? When you define your @MyUserID you can INSERT the value into your database at that time.

Why do you need it to be before the user is redirected to PayPal? That may turn out to be a problem if the user doesn't complete the payment. You should wait until after the transaction has occurred. Using IPN you'll get a post back to a notification script and you can grab the custom value and whatever else you need and toss it into a database.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top