Click here to Skip to main content
15,887,350 members
Please Sign up or sign in to vote.
1.60/5 (2 votes)
See more:
C#
protected void btnbuynow1onclick(object sender, EventArgs e)
        {
            string itemname = "12 Weeks Trail Package";
            string kitplanid = "2";
            string packageamount = "60";
            string kitpackid = "2";
            string bv = "0";
            string servicebox = "12";
            paypal(itemname,kitplanid,packageamount, kitpackid,bv,servicebox);
            

        }


C#
protected void paypal( string itemname, string kitplanid,string packageamount,string kitpackid,string bv,string servicebox)
        {
            Session["itemname"] = itemname;
            Session["kitplanid"] = kitplanid;
            Session["packageamount"] = packageamount;
            Session["kitpackid"] = kitpackid;
            Session["bv"] = bv;
            Session["servicebox"] = servicebox;
            string redirecturl = "";
            string paypalemail = "xxxxx-facilitator-1@gmail.com";
            string SuccessUrl = "http://localhost:67521/success.aspx";
            string FailedUrl = "http://localhost:67521/failure.aspx";
            redirecturl += "https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_xclick&business=" + paypalemail;
            redirecturl += "&item_name=" + itemname;
            redirecturl += "&amount=" + packageamount;
            redirecturl += "&quantity=1";
            redirecturl += "&currency=USD";
            redirecturl += "&return=" + SuccessUrl;
            redirecturl += "&cancel_return=" + FailedUrl;
            Response.Redirect(redirecturl);
        }


What I have tried:

Hi.. I am using paypal sandbox integration ... all are working fine.. after user paid the amount the page will redirected to success url.. but in success url how i get the transaction id of the order.. i dont know how to implement..
Posted
Updated 2-Jul-23 3:02am
Comments
F-ES Sitecore 22-Jun-16 6:54am    
It depends on if you are using IPN pages or not, but you get sent the data as a POST so just Request.Form["variable name here"].

PayPal has extensive documentation on their own site, it is far better to get the code from there.

1 solution

To add to what F-ES Sitecore has said, never, ever, accept code from a insecure website to handle anything to do with real money.
You do not know who is giving you the code, you do not know what it does, you do not know that it places the monies correctly into the appropriate account, without passing the details to any third parties.

Only get such code from Paypal - the scope for fraud otherwise is far too large. And remember, you personally could be liable for any monies lost if your action is seen to be negligent - which getting your code from a public forum would most certainly be!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900