protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["Status"] != "" && Request.QueryString["Status"] != null && Request.QueryString["Authority"] != "" && Request.QueryString["Authority"] != null) { if (Request.QueryString["Status"].ToString().Equals("OK")) { int Amount = 100; long RefID; System.Net.ServicePointManager.Expect100Continue = false; zarinpal.PaymentGatewayImplementationService zp = new zarinpal.PaymentGatewayImplementationService(); int Status = zp.PaymentVerification("YOUR-ZARINPAL-MERCHANT-CODE", Request.QueryString["Authority"].ToString(), Amount, out RefID); if (Status == 100) { Response.Write("Success!! RefId: " + RefID); } else { Response.Write("Error!! Status: " + Status); } } else { Response.Write("Error! Authority: " + Request.QueryString["Authority"].ToString() + " Status: " + Request.QueryString["Status"].ToString()); } } else { Response.Write("Invalid Input"); } }
protected void btnRequest_Click(object sender, EventArgs e) { System.Net.ServicePointManager.Expect100Continue = false; zarinpal.PaymentGatewayImplementationService zp = new zarinpal.PaymentGatewayImplementationService(); string Authority; int Status = zp.PaymentRequest("YOUR-ZARINPAL-MERCHANT-CODE", int.Parse(txtAmount.Text), txtDescription.Text.ToString(), "*****@*****.**", "09123456789", "http://localhost/Verify.aspx", out Authority); if (Status == 100) { Response.Redirect("https://www.zarinpal.com/pg/StartPay/" + Authority); } else { Response.Write("error: " + Status); } }