How do i get transaction id from Paypal using mvc 4 c#. I have tried a lot of the code but not working. Here is the sample of the code:
in web.config:
- <add key="CancelPurchaseUrl" value="http://localhost:5799/Unit/Index" />
- <add key="ReturnUrl" value="http://localhost:5799/Unit/GetResponse" />
- <add key="NotifyUrl" value="http://localhost:5799/Unit/GetResponse" />
- <add key="CurrencyCode" value="USD" />
- <add key="UseSandbox" value="true" />
- <add key="SendToReturnURL" value="true" />
Here is the code:- public ActionResult GetResponse()
- {
-
- try
- {
-
- string TransactionID = "NO";
- string TransactionDate = System.DateTime.Now.ToString();
- string UnitID = Session["UnitID"].ToString();
- string Amount = Session["payamount"].ToString();
- string UserEmail = Session["UserEmailMain"].ToString();
- string TransactionType = "Paypal";
- string Quantity = Session["Quantity"].ToString();
-
- PayPalModel model = new PayPalModel();
- model.TransactionID = TransactionID;
- model.TransactionDate = TransactionDate;
- model.UnitId = UnitID;
- model.Amount = Amount;
- model.UserEmail = UserEmail;
- model.TransactionType = TransactionType;
- model.Quantity = Quantity;
-
- Transaction items = new Transaction();
- items.TransactionID = model.TransactionID;
- items.TransactionDate = Convert.ToDateTime(model.TransactionDate);
- items.UnitID = Convert.ToInt32(model.UnitId);
- items.Amount = model.Amount;
- items.UserEmail = model.UserEmail;
- items.TransactionType = model.TransactionType;
- items.Quantity = Convert.ToInt32(model.Quantity);
-
-
- }
- catch { }
- return RedirectToAction("Index");
- }
here i want to return the transactionid ..
so any suggestions???