I’m using PayPal. I’m sending values to PayPal, and then getting values back. I’m not able to pass parameters because PayPal knows nothing about them. How can I get the cart values in my method without passing the parameters?
I’m able to get the values like this
public ViewResult Index(Cart cart, string returnUrl)
{
return View(new CartIndexViewModel
{
Cart = cart,
ReturnUrl = returnUrl
});
}
but, what if I’m not able to pass the (Cart cart) as a parameter – how do I get the values?
public ViewResult Index()
{
//what do i need to do here???
return View(new CartIndexViewModel
{
Cart = cart,
ReturnUrl = returnUrl
});
}
thanks for any help or advice.
I suppose you could drop cookies that store the
Cartdata for that session. Then after you get a post back from paypal or whatever you could read the cookies from the user’s request.However I would think you could save the pending transaction to the database, send whatever data it is you send to paypal, and use a key or whatever method they have to link the paypal transaction to the pending transaction in the database. This would be more secure.
I’m sure paypal has a simple and well documented transaction process, that I would look into before trying either of these.
If your actually trying to integrate with paypal and not just using that as an example, here is a tutorial for Paypal and MVC3.
From PayPal: