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:
"CancelPurchaseUrl" value="http://localhost:5799/Unit/Index" /> "ReturnUrl" value="http://localhost:5799/Unit/GetResponse" />"NotifyUrl" value="http://localhost:5799/Unit/GetResponse" />"CurrencyCode" value="USD" />"UseSandbox" value="true" />"SendToReturnURL" value="true" />
- public ActionResult GetResponse()
- {
- try
- {
- //ID, TransactionID, TransactionDate, Amount, UnitID, UserEmail, TransactionType
- 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);
- //int insertresult = objAdmin.InsertTransaction(items);
- }
- catch { }
- return RedirectToAction("Index");
- }
here i want to return the transactionid ..
so any suggestions???
sai kumarPosted Nov 26, 2017, 10:49 PM
Nilesh ShahPosted Feb 22, 2017, 3:20 PM