how to get back to main site after payment , how to return back to main site after payment.
This code is in mvc4
----------------------------------------
This is View
@model JobPortal.db.tbl_Plans
@*@{
Layout = null;
}
*@
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>SendPayment</title>
</head>
<body>
<form id="simForm" name="simForm" method='post' action='https://secure.authorize.net/gateway/transact.dll'>
@{
string itm = "" + @Model.tbl_PackageCategory.PackageCategoryName + "<|>SeekZilla<|>Employer Plan<|>1<|>" + @Model.PlanCost.ToString("F") + "<|>";
//string itm ="item1<|>golf balls<|><|>2<|>18.95<|>Y";
}
<input id="HiddenValue" type="hidden" value="Initial Value" />
<input type='hidden' name='x_line_item' id='x_line_item' value='@itm' />
<input type='hidden' name='x_login' id='x_login' value="@TempData["loginID"]" />
<input type='hidden' name='x_amount' id='x_amount' value="@Model.PlanCost.ToString("F")" />
<input type='hidden' name='x_description' id='x_description' value="Sample Transaction" />
<input type='hidden' name='x_invoice_num' id='x_invoice_num' value="@DateTime.Now.ToString(" yyyymmddhhmmss")" />
<input type='hidden' name='x_fp_sequence' id='x_fp_sequence' value="@TempData["sequence"]" />
<input type='hidden' name='x_fp_timestamp' id='x_fp_timestamp' value="@TempData["timeStamp"]" />
<input type='hidden' name='x_fp_hash' id='x_fp_hash' value="@TempData["fingerprint"]" />
<input type='hidden' name='x_test_request' id='x_test_request' value="false" />
<input type='hidden' name='x_show_form' value='PAYMENT_FORM' />
<input type=HIDDEN name="x_receipt_link_method" value="LINK">
<input type=HIDDEN name="x_receipt_link_text" value="Dont Close it, Dont go Back just Click here to confirm Payment and return to Seekzilla">
@*<input type=hidden name="x_relay_url" value="http://seekzilla.com/Employee/Plan/ReturnSuccess?empid=@WebSecurity.CurrentUserId&planid=@Model.PlanId&PlanCost=@Model.PlanCost">*@
<input type=HIDDEN name="x_u" value="http://seekzilla.com/Employee/Plan/ReturnSuccess?empid=@WebSecurity.CurrentUserId&planid=@Model.PlanId&PlanCost=@Model.PlanCost">
<input type=hidden name="x_relay_url" value="http://seekzilla.com/Home/DPMResponse">
<input type=hidden name="x_receipt_link_url" value="http://seekzilla.com/Home/DPMResponse">
<input type='hidden' name='x_cancel_url' value='http://seekzilla.com/Employee/Plan/ReturnCancel?empid=@WebSecurity.CurrentUserId&planid=@Model.PlanId' />
@*<input type='submit' id='buttonLabel' value="Submit Payment" />*@
</form>
<h4>Redirecting to Authorize payment... </h4>
<script language="javascript">
document.simForm.submit();
</script>
</body>
</html>
This code is in mvc4
----------------------------------------
This is View
@model JobPortal.db.tbl_Plans
@*@{
Layout = null;
}
*@
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>SendPayment</title>
</head>
<body>
<form id="simForm" name="simForm" method='post' action='https://secure.authorize.net/gateway/transact.dll'>
@{
string itm = "" + @Model.tbl_PackageCategory.PackageCategoryName + "<|>SeekZilla<|>Employer Plan<|>1<|>" + @Model.PlanCost.ToString("F") + "<|>";
//string itm ="item1<|>golf balls<|><|>2<|>18.95<|>Y";
}
<input id="HiddenValue" type="hidden" value="Initial Value" />
<input type='hidden' name='x_line_item' id='x_line_item' value='@itm' />
<input type='hidden' name='x_login' id='x_login' value="@TempData["loginID"]" />
<input type='hidden' name='x_amount' id='x_amount' value="@Model.PlanCost.ToString("F")" />
<input type='hidden' name='x_description' id='x_description' value="Sample Transaction" />
<input type='hidden' name='x_invoice_num' id='x_invoice_num' value="@DateTime.Now.ToString(" yyyymmddhhmmss")" />
<input type='hidden' name='x_fp_sequence' id='x_fp_sequence' value="@TempData["sequence"]" />
<input type='hidden' name='x_fp_timestamp' id='x_fp_timestamp' value="@TempData["timeStamp"]" />
<input type='hidden' name='x_fp_hash' id='x_fp_hash' value="@TempData["fingerprint"]" />
<input type='hidden' name='x_test_request' id='x_test_request' value="false" />
<input type='hidden' name='x_show_form' value='PAYMENT_FORM' />
<input type=HIDDEN name="x_receipt_link_method" value="LINK">
<input type=HIDDEN name="x_receipt_link_text" value="Dont Close it, Dont go Back just Click here to confirm Payment and return to Seekzilla">
@*<input type=hidden name="x_relay_url" value="http://seekzilla.com/Employee/Plan/ReturnSuccess?empid=@WebSecurity.CurrentUserId&planid=@Model.PlanId&PlanCost=@Model.PlanCost">*@
<input type=HIDDEN name="x_u" value="http://seekzilla.com/Employee/Plan/ReturnSuccess?empid=@WebSecurity.CurrentUserId&planid=@Model.PlanId&PlanCost=@Model.PlanCost">
<input type=hidden name="x_relay_url" value="http://seekzilla.com/Home/DPMResponse">
<input type=hidden name="x_receipt_link_url" value="http://seekzilla.com/Home/DPMResponse">
<input type='hidden' name='x_cancel_url' value='http://seekzilla.com/Employee/Plan/ReturnCancel?empid=@WebSecurity.CurrentUserId&planid=@Model.PlanId' />
@*<input type='submit' id='buttonLabel' value="Submit Payment" />*@
</form>
<h4>Redirecting to Authorize payment... </h4>
<script language="javascript">
document.simForm.submit();
</script>
</body>
</html>
------------------------------------------------
so just set ur return url like that
<input type=HIDDEN name="x_u" value="http://seekzilla.com/Employee/Plan/ReturnSuccess?empid=@WebSecurity.CurrentUserId&planid=@Model.PlanId&PlanCost=@Model.PlanCost">
and in controller or code user that function
----------------------------------
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult DPMResponse(FormCollection post)
{
var response = new SIMResponse(post);
// First order of business - validate that it was Authorize.Net
// that posted this using the MD5 hash that was passed back to us
var isValid = response.Validate("123456", "647h2FaTEJR6");
// If it's not valid - just send them to the home page.
if (!isValid)
return Redirect("/");
// The URL to redirect to MUST be absolute
var returnUrl = post["x_u"].ToString();// "http://seekzilla.com/Home/DPMReceipt?m=" + response.Message;
return Content(string.Format("<html><head><script type='text/javascript' charset='utf-8'>window.location='{0}';</script><noscript><meta http-equiv='refresh' content='1;url={0}'></noscript></head><body></body></html>", returnUrl));
}
so final what is happening
-----------------------------
payment gateway return on DPMResponse and then we get ur url from formcollection and just redirect on it.
one more thing
u set default return url from authorization control panel like
<input type=hidden name="x_receipt_link_url" value="http://seekzilla.com/Home/DPMResponse">