locked
payment Gatway Implement Problem RRS feed

  • Question

  • User1908278553 posted

    hI,

    HAVE ANY BODY IMPLEMENT THIS PAYMENT GATWAY?

    https://payment.aimevents.net/vpc_asp_merchanthost_csc_txsrc.html

    IF ANY BODY IMPLEMENT THEN KINLY HELP ME AND SEND C# CORRECT CODE

    BEOCOZ I USE THIS CODE AN GIVING "Payment Server System Error"

     Card Type

    PAN

    Expiry Date

    MasterCard

    5123456789012346

    05/13

    Visa

    4005550000000001

    05/13

      private String readHtmlPage(string transactionref , string url, string card_no, string exp_date, string cvc, string ItemPrice)
            {


                String result = "";
                string PostStr = "";
                Random rnd = new Random();




                string timeStamp = Convert.ToString((DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds);
                string sequence = Convert.ToString(rnd.Next(0, 1000));
                string accesscode = null;
                string marchantID = null;
                marchantID = "TEST002200525558";
                accesscode = "5B9DB8C4";
                //List<user> lstUser = new List<user>();

                //lstUser = getUserById(UserID);
                    PostStr += "vpc_Version=1";
                    PostStr += "&vpc_Command=pay";
                    PostStr += "&vpc_TxSource=INTERNET";
                    PostStr += "&vpc_Merchant=" + marchantID;
                    PostStr += "&vpc_AccessCode=" + accesscode;
                    PostStr += "&vpc_MerchTxnRef=" + transactionref;
                    PostStr += "&vpc_Amount=" + ItemPrice;
                    PostStr += "&vpc_OrderInfo=VPC Example";
                    PostStr += "&vpc_CardNum=" + card_no;
                    PostStr += "&vpc_CardExp=" + 1305;
                
                  //if(!string.IsNullOrEmpty(cvc))
                  //{ PostStr += "&vpc_CardSecurityCode=" + cvc; }
                      
                      
                    //PostStr += "&x_fp_timestamp=" + timeStamp;
                    //PostStr += "&x_fp_hash=" + HMAC_MD5(transactionKey, loginID + "^" + sequence + "^" + timeStamp + "^" + ItemPrice + "^");
                    //*************************

                  //  PostStr += "&x_test_request=Ture&x_version=3.1";


                    //************ Testing ****************
                    //string Server = "https://developer.authorize.net/tools/paramdump/index.php?" + PostStr;
                    //Response.Redirect(Server);
                    //*************************************

                    String strPost = PostStr;
                    StreamWriter myWriter = null;

                    HttpWebRequest objRequest = (HttpWebRequest)WebRequest.Create(url);
                    objRequest.Method = "POST";
                    objRequest.ContentLength = strPost.Length;
                    objRequest.ContentType = "application/x-www-form-urlencoded";

                    try
                    {
                        myWriter = new StreamWriter(objRequest.GetRequestStream());
                        myWriter.Write(strPost);
                    }
                    catch (Exception e)
                    {
                        return e.Message;
                    }
                    finally
                    {
                        myWriter.Close();
                    }

                    HttpWebResponse objResponse = (HttpWebResponse)objRequest.GetResponse();
                    StreamReader sr = new StreamReader(objResponse.GetResponseStream());
                    result = sr.ReadToEnd();

                    // Close and clean up the StreamReader
                    sr.Close();
                    string[] responses = result.Split('&');
                      for (int i = 0; i < responses.Length; i++)
                      {
                          if (responses[i].Contains("vpc_TxnResponseCode"))
                          {
                              string[] splitresp = responses[i].Split('=');
                              if (splitresp[1] != "0")
                              {
                                  result = getResponseDescription(splitresp[1]);
                              }
                              else {
                                  result = "";
                              }
                          }
                      }
                return result;
            }


            protected void brnSend_Click(object sender, EventArgs e)
            {
                try
                {
                    string Server = "https://migs.mastercard.com.au/vpcdps";
                    string respon = readHtmlPage("1", Server, txtcardnumber.Text,(ddlExpiryYear.SelectedValue.ToString() + ddlExpiryMonth.SelectedValue.ToString()) , txtCardSecurityCode.Text, txtAmountCharged.Text);
                    if (respon == "Transaction Successful")
                    {
                        if (Session["UserId"] != null)
                        {
                            DBUserProgrammes.Create(Convert.ToInt16(Session["UserId"]), Convert.ToInt32(ViewState["CourseId"]), ProgramtypeId, DateTime.Now, ProgrameName, 1);
                        }
                        lblMessage.Text = "";
                        if (hdnCourseRegistration.Value != "0")
                        {
                            DBtkg_OnlineCreditcardPayment.Update(Convert.ToInt32(hdnCourseRegistration), Convert.ToInt32(Session["UserId"].ToString()), Convert.ToInt32(ViewState["CourseId"]), txtNameofRegistrant.Text, txtReceiptEmail.Text, txtNameAppearonCrdtCrd.Text, txtPhoneNumber.Text, ddlCreditCardType.SelectedItem.Text, txtcardnumber.Text, DateTime.Now, txtCardSecurityCode.Text, txtAmountCharged.Text, txtAddress.Text, ddlCity.SelectedItem.Text, txtState.Text, ddlcountry.SelectedItem.Text, txtZipCode.Text, 1, true, DateTime.Now, respon);
                            ClearFields();
                            Response.Redirect("thanks-you.aspx");
                        }
                        else
                        {
                            DBtkg_OnlineCreditcardPayment.Create(Convert.ToInt32(Session["UserId"].ToString()), Convert.ToInt32(ViewState["CourseId"]), txtNameofRegistrant.Text, txtReceiptEmail.Text, txtNameAppearonCrdtCrd.Text, txtPhoneNumber.Text, ddlCreditCardType.SelectedItem.Text, txtcardnumber.Text, DateTime.Now, txtCardSecurityCode.Text, txtAmountCharged.Text, txtAddress.Text, ddlCity.SelectedItem.Text, txtState.Text, ddlcountry.SelectedItem.Text, txtZipCode.Text, 1, true, DateTime.Now, respon);
                            ClearFields();
                            Response.Redirect("thanks-you.aspx");
                        }
                    }
                    else
                    {
                        lblMessage.Text = respon;
                    }

                }
                catch (Exception ex)
                {
                }
            }

    Monday, April 8, 2013 8:58 AM

Answers

  • User1908278553 posted

    the solution find why Error Occure ....

    when i pass following credintional then Return "Approve " Status.

    i just add           PostStr += "&vpc_Locale=en"; & then the value of itemprice not great then 100 or 200

      PostStr += "vpc_Version=1";
                    PostStr += "&vpc_Command=pay";
                    //PostStr += "&vpc_TxSource=INTERNET";
                    PostStr += "&vpc_Locale=en";
                
                    PostStr += "&vpc_Merchant=" + marchantID;
                    PostStr += "&vpc_AccessCode=" + accesscode;
                    PostStr += "&vpc_MerchTxnRef=" + transactionref;
                    PostStr += "&vpc_Amount=" + 100;
                    PostStr += "&vpc_OrderInfo=VPC Example";
                    PostStr += "&vpc_CardNum=" + 5123456789012346;
                    PostStr += "&vpc_CardExp=" + 1305;

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, April 8, 2013 10:22 AM

All replies

  • User1908278553 posted

    the solution find why Error Occure ....

    when i pass following credintional then Return "Approve " Status.

    i just add           PostStr += "&vpc_Locale=en"; & then the value of itemprice not great then 100 or 200

      PostStr += "vpc_Version=1";
                    PostStr += "&vpc_Command=pay";
                    //PostStr += "&vpc_TxSource=INTERNET";
                    PostStr += "&vpc_Locale=en";
                
                    PostStr += "&vpc_Merchant=" + marchantID;
                    PostStr += "&vpc_AccessCode=" + accesscode;
                    PostStr += "&vpc_MerchTxnRef=" + transactionref;
                    PostStr += "&vpc_Amount=" + 100;
                    PostStr += "&vpc_OrderInfo=VPC Example";
                    PostStr += "&vpc_CardNum=" + 5123456789012346;
                    PostStr += "&vpc_CardExp=" + 1305;

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, April 8, 2013 10:22 AM
  • User-1000095884 posted

    Hi,

    Glad to hear that the issue is resolved and thanks for the useful feedback.

    Best Regards.

    Tuesday, April 9, 2013 2:35 AM