| Guest Author: Vijay Yadav 06 Aug 2012 |
Hi Ravindran,
Thanks a lot for this article.
I followed your steps but after running the application and I clicked on 'Buy Now' button, it redirects me to the below link: https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_xclick&business=vijay_1344262433_biz@gmail.com&first_name=vijay&city=mumbai&state=maharashtra&item_name=Laptop&amount=$100&shipping=5&handling=5&tax=5&quantity=1%c2%a4cy=USD&return=http://localhost:2525/PayPalApp/Success.aspx&cancel_return=http://localhost:2525/PayPalApp/Failed.aspx
Not to the page that you have shown in the article. May I know where I went wrong?
|
| Author: Ravindran 06 Aug 2012 | Member Level: Diamond Points : 1 |
yes in that page paypal login is there?
Steps to Execute Details Output below image....is appear after you redirect to that URL and make sure you must signin paypal account in the same browser.
Please read in that source attached document
|
| Author: vijay yadav 06 Aug 2012 | Member Level: Bronze Points : 1 |
Hi Ravindran,
Thanks for your reply.
I have Logged in as per your suggestion but then I redirected to the Test Account page of the sandbox. and I have also gone through the document and i clicked on the enter Sandbox test site but there I don't find any Profile option. Can Please help me out?
|
| Author: vijay yadav 06 Aug 2012 | Member Level: Bronze Points : 1 |
Hi Ravindran,
Thanks for your reply.
I have Logged in as per your suggestion but then I redirected to the Test Account page of the sandbox. and I have also gone through the document and i clicked on the enter Sandbox test site but there I don't find any Profile option. Can Please help me out?
|
| Author: Ravindran 07 Aug 2012 | Member Level: Diamond Points : 3 |
Follow this vijay,
Login in https://developer.paypal.com/ and goto test account then choose "Business" account radio button then click "Enter sandbox test site".
After that login in new popup window login with seller acount mean business account. Under the menu bar profile link button --> then more options in the menu under Selling Preferences choose Website Payment Preferences
Select Auto Return on radio button to redirect and enter return url any valid domain (like http://www.urname.blogspot.com)
Enable on Payment Data Transfer to get payment data return in website and save it.
Again go to more option website payment reference and see identity token is generated (under payment data transfer) copy that identity token use it in the website.
|
| Author: vijay yadav 08 Aug 2012 | Member Level: Bronze Points : 2 |
Hi Ravindran,
Thanks again, I have followed the above steps and completed the settings mentioned by you. And I ran the application, it got opened in IE and in another tab of IE,I have opened the https://developer.paypal.com/ URL and logged in with my paypal account and now when I clicked the Buy now button in the gridview, it redirects me to the "Error - Return To merchant page" It says
Return to Vijay yadav's Test Store
At this time, we are unable to process your request. Please return to Vijay yadav's Test Store and try another option.
Can you please tell me where i am wrong? Thanks
|
| Author: Ravindran 08 Aug 2012 | Member Level: Diamond Points : 1 |
Vijay,
Mistake in that currency paramater just rewrite that code in code behind
//Currency code redirecturl += "¤cy=USD";
And download my full source below resource to check it. Make sure you are change return url or success url as per your port or current website url in web.config file.
|
| Author: vijay yadav 08 Aug 2012 | Member Level: Bronze Points : 0 |
Hi Ravindran,
I rewritted the code and changed the port in the web config file but still it redirects to the Error - return to Merchant page.
|
| Author: Ravindran 08 Aug 2012 | Member Level: Diamond Points : 0 |
vijay,
see my above comment or mail me nravindranmca at gmail.com
|
| Author: vijay yadav 08 Aug 2012 | Member Level: Bronze Points : 0 |
ok I will email you.
|
| Author: vijay yadav 08 Aug 2012 | Member Level: Bronze Points : 0 |
Nice Article, really helped out.
Thanks!
|
| Guest Author: anil babu 20 Aug 2012 |
Why Add values dynamically? the values comming from database values?
My question is The gridview values comming from database
|
| Author: Ravindran 23 Aug 2012 | Member Level: Diamond Points : 5 |
Anil,
Just i give an simple code to reader understand easily PayPal integration in ASP.NET
Refer below as per your requirement code for Default.aspx.cs
using System.Data; using System.Data.SqlClient; using System.Configuration;
public partial class _Default : System.Web.UI.Page { SqlConnection sqlcon = new SqlConnection(ConfigurationManager.ConnectionStrings["Con"].ToString()); SqlCommand sqlcmd = new SqlCommand(); SqlDataAdapter da = new SqlDataAdapter(); DataTable dt = new DataTable(); string query;
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { BindGrid(); } } void BindGrid() { sqlcmd = new SqlCommand("select pname,pdesc,price from productTable", sqlcon); sqlcon.Open(); da = new SqlDataAdapter(sqlcmd); da.Fill(dt); GridView1.DataSource = dt; GridView1.DataBind(); sqlcon.Close(); } protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "buy") { ImageButton ib = (ImageButton)e.CommandSource; int index = Convert.ToInt32(ib.CommandArgument); GridViewRow row = GridView1.Rows[index];
//Get each Column label value from grid view and store it in label Label l1 = (Label)row.FindControl("Label1"); Label l2 = (Label)row.FindControl("Label2"); Label l3 = (Label)row.FindControl("Label3");
//here i temporary use my name as logged in user you can create login page after only make an order Session["user"] = "ravi";
//After user clik buy now button store that details into the sql server "purchase" table for reference string query = ""; query = "insert into purchase(pname,pdesc,price,uname) values('" + l1.Text + "','" + l2.Text + "','" + l3.Text.Replace("$","") + "','" + Session["user"].ToString() + "')"; sqlcon.Open(); sqlcmd = new SqlCommand(query, sqlcon); sqlcmd.ExecuteNonQuery(); sqlcon.Close();
//Pay pal process Refer for what are the variable are need to send http://www.paypalobjects.com/IntegrationCenter/ic_std-variable-ref-buy-now.html string redirecturl = "";
//Mention URL to redirect content to paypal site redirecturl += "https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_xclick&business=" + ConfigurationManager.AppSettings["paypalemail"].ToString();
//First name i assign static based on login details assign this value redirecturl += "&first_name=ravindran";
//City i assign static based on login user detail you change this value redirecturl += "&city=chennai";
//State i assign static based on login user detail you change this value redirecturl += "&state=tamilnadu";
//Product Name redirecturl += "&item_name=" + l1.Text;
//Product Amount redirecturl += "&amount=" + l3.Text;
//Business contact id //redirecturl += "&business=nravindranmcaatgmail.com";
//Shipping charges if any redirecturl += "&shipping=5";
//Handling charges if any redirecturl += "&handling=5";
//Tax amount if any redirecturl += "&tax=5"; //Add quatity i added one only statically redirecturl += "&quantity=1";
//Currency code redirecturl += "¤cy=USD";
//Success return page url redirecturl += "&return=" + ConfigurationManager.AppSettings["SuccessURL"].ToString();
//Failed return page url redirecturl += "&cancel_return=" + ConfigurationManager.AppSettings["FailedURL"].ToString();
Response.Redirect(redirecturl); } }
|
| Guest Author: kashyap 12 Oct 2012 |
thanks for solution but i dont understand that how to refund the payment can any one help me?
|
| Author: Ilakkiya 01 Nov 2012 | Member Level: Bronze Points : 1 |
Hello Ravindran.. Nice Article, really helped me out. Thank u very much... i had a copy of ur article,its ran in fine way and i integrate this into my website too.. Now,i have one doubt.. Can u please specify, when i host my website in live, what are the changes i supposed to do? and where i do those changes...explain this with ur example article..
|
| Author: Ravindran 03 Nov 2012 | Member Level: Diamond Points : 1 |
hi,
just you need only url like for testing we are use www.sandbox.paypal.com and if your project go for live just change url in the config file like www.paypal.com its enough no need to change anywhere else
|
| Guest Author: Kevin 10 Nov 2012 |
See full source code on http://www.thecodenode.com/PayPalAPICSharpdotNetWrapper.aspx
|
| Guest Author: Pankaj 22 Nov 2012 |
Auto redirecting is not working Y???
|
| Author: Ravindran 29 Nov 2012 | Member Level: Diamond Points : 0 |
Pankaj please read my above my comments and follow this to sort out your issue
|
| Author: Programmer 09 Dec 2012 | Member Level: Gold Points : 2 |
Dear Ravindran, This is best code of paypal integration.I could tranfer the amount from the buyer account to seller account.Now I want to integrate this on my live site.Should I create account on www.paypal.com since I want to only receive payment.
|
| Author: Ravindran 09 Dec 2012 | Member Level: Diamond Points : 3 |
Programmer
You need change url like for testing we are use www.sandbox.paypal.com and if your project go for live just change url in the config file like www.paypal.com its enough no need to change anywhere else(mean coding). And normal sandbox login details account not work in live paypal.com site. Please register according to your detail in live site use that in your project
|
| Guest Author: anonymous user 02 Jan 2013 |
thanks buddy, it is easy as 1 2 3,
|
| Guest Author: Julian Mummery 06 Jan 2013 |
Hi,
Great article.
The reason why some of you are having issues with the automatic redirec and cannot find the following menu in Vijay's tutorial is because you are using a preconfigured business acoount:
New test account: Preconfigured| Create Manually
To resolve this issue create a fresh business account but use the 'Create Manually' link instead of the 'Preconfigured' link. Once you have done that Vijay's instructions will work.
Kind Regards Julian Mummery
|
| Guest Author: dsouchon 05 Feb 2013 |
Thank you Rav! Well done! This is the first tutorial (including PayPal official documentation) that I have tried that actually works from beginning to end. Don't miss ANY of the steps and it will work for you.
Notes: 1. You must be logged in to PayPal sandbox on a separate tab when debugging the app. for it to work. 2. The "token" value in web.config is the API Signature found by clicking on API and Payment Card Credentials in Left Nav Bar in Sandbox - look in Test Account Box for Signature 3. The "paypalemail" value is the seller Test Account email address NOT the API username - also found at the top of the Test Account Box.
|
| Guest Author: Shanth kumar Naik 07 Feb 2013 |
Hi Ravindran,
Thanks lot,This article helped lot for integrating paypal to my web site(Esente skin care medicine prodcut selling online).
I need a help that,after click on PayNow button in paypal page,then i need to capture transaction ID and automatically redirect to success.aspx page in my site.
Please support.
Thanks & Regards, L.shanthKumar Naik AROKIA IT LTD Bangalore
|
| Guest Author: himanshu 09 Feb 2013 |
Hello Sir, Thanks For The article It worked perfectly fine. I just want to know if i will change www.sandbox.paypal.com to www.paypal.com
than what will be the key="?" value="?" for www.paypal.com as shown below(for sandbox)
add key ="paypalemail" value ="nravin_1335778770_biz@gmail.com"
Please Revert soon thanks and regards
|
| Guest Author: Eldhose P Kuriakose 13 Feb 2013 |
After payment in Paypal when we return back to our own website, if the session got expired and the userid in the session got cleared what can we do... is there a way that we can "pass" an id to paypal and in return we get that id back...
|
| Guest Author: Ahmad 16 Feb 2013 |
Hi, thanks for all your help, 1-These examples are for a buyer with a paypal account. How can I have a buyer without paypal account(we have his info such as credit card number, expire date ,...) and we can pass all this data for transaction. 2- How can I have a buyer without credit card, I mean a person with just checking account (router number and account number) ? Thanks in advance
|
| Guest Author: Ahmad 16 Feb 2013 |
Hi, thanks for all your help, 1-These examples are for a buyer with a paypal account. How can I have a buyer without paypal account(we have his info such as credit card number, expire date ,...) and we can pass all this data for transaction. 2- How can I have a buyer without credit card, I mean a person with just checking account (router number and account number) ? Thanks in advance
|
| Guest Author: Shyam 13 Jun 2013 |
Hi Ravindran,
Thanks for this great article, i have been searching for this for long time.The sample you have provided is working fine.
I just want to know if any how i can get the transaction id for the completed transaction.
Thanks Shyam
|