Wednesday 12 June 2013

Payment Gateway Integration in ASP.NET Application



protected void btnContinue_Click(object sender, EventArgs e)
    {
        //string strId = UserId_TextBox.Text;
        //string strName = Name_TextBox.Text;

        ASCIIEncoding encoding = new ASCIIEncoding();
        string postData = "ssl_merchant_id=" + System.Configuration.ConfigurationSettings.AppSettings.Get("userid");
        postData += ("&ssl_user_id=" + System.Configuration.ConfigurationSettings.AppSettings.Get("username"));
        postData += ("&ssl_pin=" + System.Configuration.ConfigurationSettings.AppSettings.Get("pinno"));
        postData += ("&ssl_show_form=" + "true");
        postData += ("&ssl_test_mode=" + "true");
        postData += ("&ssl_invoice_number" + "123-achbiz-001");
        postData += ("&ssl_transaction_type" + "ccsale");
        postData += ("&ssl_amount=" + "5.95");
        postData += ("&ssl_salestax" + "0.00");
        byte[] data = encoding.GetBytes(postData);

        // Prepare web request...
        HttpWebRequest myRequest =(HttpWebRequest)WebRequest.Create("https://www.myvirtualmerchant.com/VirtualMerchant/process.do");
    
        myRequest.Method = "POST";
        myRequest.ContentType = "application/x-www-form-urlencoded";
        myRequest.ContentLength = data.Length;
        Stream newStream = myRequest.GetRequestStream();
        // Send the data.
        newStream.Write(data, 0, data.Length);
        newStream.Close();

    }

No comments:

Post a Comment

C# LINQ Joins With SQL

There are  Different Types of SQL Joins  which are used to query data from more than one database tables. In this article, you will learn a...