Reputation: 41
Does Any Body Knows That Why Is This Hapening because its not showing the content I want it to show. It supposed to show the order id, product price and quantity.
This is my coding.
Response.Write("<form action='https://www.sandbox.paypal.com/cgi-bin/webscr' method='post' name='buyCredits' id='buyCredits'>");
Response.Write("<input type='hidden' name='cmd' value='_xclick'>");
Response.Write("<input type='hidden' name='business' value='[email protected]'>");
Response.Write("<input type='hidden' name='currency_code' value'USD'>");
Response.Write("<input type='hidden' name='item_name' value'payment for items'>");
Response.Write("<input type='hidden' name='item_number' value'" + Id.ToString() + "'>");
Response.Write("<input type='hidden' name='amount' value'" + Session["total"].ToString() + "'>");
Response.Write("<input type='hidden' name='return' value'http://localhost:49584/payment_success.aspx?order=" + orderId.ToString() + "'>");
Response.Write("</form>");
Response.Write("<script type='text/javascript'>");
Response.Write("document.getElementById('buyCredits').submit();");
Response.Write("</script>");
Please check the image for results of the coding above.
Upvotes: 1
Views: 80
Reputation: 6417
You are missing a bunch of equals signs like;
value'USD'
should be
value='USD'
Also your return URL is localhost... This will only work locally and not when you deploy this.
Is there a reason you are directly writing this to the response? That is generally not a good idea (and certainly not idiomatic MVC, which you have tagged the question with so I presume you are using)...
Hopefully this is a learning project and not a real application as if you are dealing with real payments you should probably have more robust code...
Upvotes: 3