/// <summary> /// Process credit card /// </summary> /// <param name="payment"></param> /// <returns></returns> public static string ProcessCreditCard(PaymentInformation payment) { string response = ""; string mRequestId = ""; string transactionReqt = ""; transactionReqt += "NAME=" + payment.NameOnCard + "&"; transactionReqt += "ACCT=" + payment.CreditCardNumber + "&"; transactionReqt += "EXPDATE=" + payment.CardExpirationMonth + payment.CardExpirationYear + "&"; transactionReqt += "AMT=" + payment.TransactionAmount + "&"; transactionReqt += "STREET=" + payment.Street + "&"; transactionReqt += "CITY=" + payment.City + "&"; transactionReqt += "STATE=" + payment.State + "&"; transactionReqt += "ZIP=" + payment.Zip + "&"; transactionReqt += "CVV2=" + payment.CreditCardVerificationCode + "&"; transactionReqt += "TRXTYPE=S&TENDER=C&"; transactionReqt += "USER="******"&"; transactionReqt += "VENDOR=" + PayflowUtility.AppSettings(LACESConstant.PaymentInfo.VENDOR) + "&"; transactionReqt += "PARTNER=" + PayflowUtility.AppSettings(LACESConstant.PaymentInfo.PARTNER) + "&"; transactionReqt += "PWD=" + PayflowUtility.AppSettings(LACESConstant.PaymentInfo.PWD); mRequestId = PayflowUtility.RequestId; PayflowNETAPI PayflowNETAPI = new PayflowNETAPI(); //TransactionReqt = "TRXTYPE=S&ACCT=5105105105105101&EXPDATE=0109&TENDER=C&INVNUM=INV12345&AMT=25.12&PONUM=PO12345&STREET=123 Main St.&ZIP=12345&CVV2=123&USER=zmiller636&VENDOR=zmiller636&PARTNER=paypal&PWD=luvspurple1"; response = PayflowNETAPI.SubmitTransaction(transactionReqt, mRequestId); return(response); }
public static void Main(string[] Args) { Console.WriteLine("------------------------------------------------------"); Console.WriteLine("Executing Sample from File: NVPCommandLine.cs"); Console.WriteLine("------------------------------------------------------"); String ResponseStr = null; if (Args.Length < 4) { Console.WriteLine(Environment.NewLine + "Incorrect number of arguments. Usage:" + Environment.NewLine + "SamplesCS <hostAddress> <hostPort> <parmList> <timeOut> <proxyAddress> <proxyPort> <proxyLogon> <proxyPassword>"); Console.WriteLine(Environment.NewLine + "Example transaction:" + Environment.NewLine + "SamplesCS pilot-payflowpro.paypal.com 443 \"USER=<user>&TRXTYPE[1]=A&VENDOR=<vendor>&AMT[5]=25.00&PWD=<password>&PARTNER=<partner>&TENDER[1]=C&ACCT[16]=5100000000000008&EXPDATE[4]=0125\" 45"); Console.WriteLine(Environment.NewLine + "Press Enter to Exit ..."); Console.ReadLine(); System.Environment.Exit(-1); } PayflowNETAPI PayflowNETAPI; if (Args.Length == 4) { PayflowNETAPI = new PayflowNETAPI(Args[0], System.Convert.ToInt32(Args[1]), System.Convert.ToInt32(Args[3])); } else { PayflowNETAPI = new PayflowNETAPI(Args[0], System.Convert.ToInt32(Args[1]), System.Convert.ToInt32(Args[3]), Args[4], System.Convert.ToInt32(Args[5]), Args[6], Args[7]); } ResponseStr = PayflowNETAPI.SubmitTransaction(Args[2], PayflowUtility.RequestId); // To write the Response on to the console. Console.WriteLine(Environment.NewLine + "Request = " + PayflowNETAPI.TransactionRequest); Console.WriteLine(Environment.NewLine + "Response = " + ResponseStr); // Following lines of code are optional. // Begin optional code for displaying SDK errors ... // It is used to read any errors that might have occurred in the SDK. // Get the transaction errors. String TransErrors = PayflowNETAPI.TransactionContext.ToString(); if (TransErrors != null && TransErrors.Length > 0) { Console.WriteLine(Environment.NewLine + "Transaction Errors from SDK = " + TransErrors); } Console.WriteLine(Environment.NewLine + "Status: " + PayflowUtility.GetStatus(ResponseStr)); Console.WriteLine(Environment.NewLine + "Press Enter to Exit ..."); Console.ReadLine(); }
/// <summary> /// Process a payment transaction /// </summary> /// <param name="request">A PayPalRequest object containing the information to process.</param> /// <returns>A PayPalResponse object with the payment gateway's response.</returns> public CreditCardCancelResponse ProcessTransaction(CreditCardCancelRequest request) { CreditCardCancelResponse response = new CreditCardCancelResponse(); PayflowNETAPI payflowNetApi = new PayflowNETAPI(request.HostAddress, request.HostPort, request.TimeOut); string apiResponse = payflowNetApi.SubmitTransaction(request.ParmList.ToString(),PayflowUtility.RequestId); response = ParseApiResponse(apiResponse); return response; }
/// <summary> /// Process a payment transaction /// </summary> /// <param name="request">A PayPalRequest object containing the information to process.</param> /// <returns>A PayPalResponse object with the payment gateway's response.</returns> public ACHRecurringSaleResponse ProcessTransaction(ACHRecurringSaleRequest request) { ACHRecurringSaleResponse response = new ACHRecurringSaleResponse(); PayflowNETAPI payflowNetApi = new PayflowNETAPI(request.HostAddress, request.HostPort, request.TimeOut); string apiResponse = payflowNetApi.SubmitTransaction(request.ParmList.ToString(), PayflowUtility.RequestId); response = ParseApiResponse(apiResponse); return response; }
public static void Main(string[] Args) { Console.WriteLine("------------------------------------------------------"); Console.WriteLine("Executing Sample from File: XMLPayCommandLine.cs"); Console.WriteLine("------------------------------------------------------"); if (Args.Length < 4) { Console.WriteLine(Environment.NewLine + "Incorrect number of arguments. Usage:" + Environment.NewLine + "SamplesCS <hostAddress> <hostPort> <xml-parmList> <timeout> <proxyAddress> <proxyPort> <proxyLogon> <proxyPassword>"); Console.WriteLine(Environment.NewLine + "Example transaction:" + Environment.NewLine + "SamplesCS pilot-payflowpro.paypal.com 443 \"<?xml version='1.0'?><XMLPayRequest Timeout='45' version='2.0'><RequestData><Partner>[partner]</Partner><Vendor>[vendor]</Vendor><Transactions><Transaction><Sale><PayData><Invoice><TotalAmt Currency='USD'>25.12</TotalAmt><InvNum>INV12345</InvNum><BillTo><PONum>PO12345</PONum><Address><Street>123 Main St.</Street><Zip>12345</Zip></Address></BillTo></Invoice><Tender><Card><CardNum>5105105105105100</CardNum><ExpDate>201501</ExpDate></Card></Tender></PayData></Sale></Transaction></Transactions></RequestData><RequestAuth><UserPass><User>[user]</User><Password>[password]</Password></UserPass></RequestAuth></XMLPayRequest>\" 45"); Console.WriteLine(Environment.NewLine + "Press Enter to Exit ..."); Console.ReadLine(); System.Environment.Exit(-1); } PayflowNETAPI PayflowNETAPI; if (Args.Length == 3) { PayflowNETAPI = new PayflowNETAPI(Args[0], System.Convert.ToInt32(Args[1]), System.Convert.ToInt32(Args[3])); } else { PayflowNETAPI = new PayflowNETAPI(Args[0], System.Convert.ToInt32(Args[1]), System.Convert.ToInt32(Args[3]), Args[4], System.Convert.ToInt32(Args[5]), Args[6], Args[7]); } String ResponseStr = PayflowNETAPI.SubmitTransaction(Args[2], PayflowUtility.RequestId); // To write the Response on to the console. Console.WriteLine(Environment.NewLine + "Request = " + PayflowNETAPI.TransactionRequest); Console.WriteLine(Environment.NewLine + "Response = " + ResponseStr); // Following lines of code are optional. // Begin optional code for displaying SDK errors ... // It is used to read any errors that might have occurred in the SDK. // Get the transaction errors. String TransErrors = PayflowNETAPI.TransactionContext.ToString(); if (TransErrors != null && TransErrors.Length > 0) { Console.WriteLine(Environment.NewLine + "Transaction Errors from SDK = " + TransErrors); } Console.WriteLine(Environment.NewLine + "Status: " + PayflowUtility.GetStatus(ResponseStr)); Console.WriteLine(Environment.NewLine + "Press Enter to Exit ..."); Console.ReadLine(); }
protected void btnSubmit_Click(object sender, EventArgs e) { try { string PayPalRequest = "TRXTYPE=S" //S - sale transaction + "&TENDER=C" //C - Credit card + "&ACCT=" + txtCardNumber.Text //card number + "&EXPDATE=" + ddlMonth.SelectedValue + ddlYear.SelectedValue.Substring(2, 2) + "&CVV2=" + txtCvv.Text //card validation value (card security code) + "&AMT=" + txtAmount.Text + "&COMMENT1=My Product Sale" + "&USER="******"USER"] + "&VENDOR=" + ConfigurationManager.AppSettings["VENDOR"] + "&PARTNER=" + ConfigurationManager.AppSettings["PARTNER"] + "&PWD=" + ConfigurationManager.AppSettings["PWD"]; // Create an instantce of PayflowNETAPI. PayflowNETAPI PayflowNETAPI = new PayflowNETAPI(); // RequestId is a unique string that is required for each & every transaction. // The merchant can use her/his own algorithm to generate this unique request id or // use the SDK provided API to generate this as shown below (PayflowUtility.RequestId). string PayPalResponse = PayflowNETAPI.SubmitTransaction(PayPalRequest, PayflowUtility.RequestId); //place data from PayPal into a namevaluecollection NameValueCollection RequestCollection = GetPayPalCollection(PayflowNETAPI.TransactionRequest); NameValueCollection ResponseCollection = GetPayPalCollection(PayPalResponse); //show request lblResult.Text = "<span class=\"heading\">PayPal Payflow Pro transaction request</span><br />"; lblResult.Text += ShowPayPalInfo(RequestCollection); //show response lblResult.Text += "<br /><br /><span class=\"heading\">PayPal Payflow Pro transaction response</span><br />"; lblResult.Text += ShowPayPalInfo(ResponseCollection); //show transaction errors if any string TransErrors = PayflowNETAPI.TransactionContext.ToString(); if (TransErrors != null && TransErrors.Length > 0) { lblResult.Text += "<br /><br /><span class=\"bold-text\">Transaction Errors:</span> " + TransErrors; } //show transaction status lblResult.Text += "<br /><br /><span class=\"bold-text\">Status:</span> " + PayflowUtility.GetStatus(PayPalResponse); } catch (Exception ex) { lblError.Text = ex.Message.ToString(); } }
public static Dictionary<string, string> SubmitPaymentRequest(Dictionary<string, string> requestNvps, PayflowProSettingsDto settings, UserContext userContext, IEntityContext entityContext) { CheckSettings(settings); //Add Settings to Request String var nvpRequest = new StringBuilder(); var accountNum = string.Empty; var securityCode = string.Empty; nvpRequest.AppendFormat(CultureInfo.InvariantCulture, "USER={0}&VENDOR={1}&PARTNER={2}&PWD={3}", settings.UserId, settings.VendorId, settings.Partner, settings.Password); foreach (var nvp in requestNvps) { nvpRequest.AppendFormat(CultureInfo.InvariantCulture, "&{0}={1}", nvp.Key, nvp.Value); if (nvp.Key == Constants.AccountNumber) accountNum = nvp.Value; if (nvp.Key == Constants.VerificationCode) securityCode = nvp.Value; } //Create API Request Object var payflowApi = new PayflowNETAPI(); var hostAddress = settings.Environment.ToUpperInvariant() == "SANDBOX" ? "pilot-payflowpro.paypal.com" : "payflowpro.paypal.com"; payflowApi.SetParameters(hostAddress, 443, 45, "", 0, "", "", "enabled", "1", "payflow.log", "10240000", false); //Send request and retrieve response var response = payflowApi.SubmitTransaction(nvpRequest.ToString(), PayflowUtility.RequestId); //Parse Response var responseNvp = new Dictionary<string, string>(); foreach (var pair in response.Split('&')) { var values = pair.Split('='); if (values.Length == 2) responseNvp.Add(values[0], values[1]); } //TODO: edit from original var pnref = responseNvp.ContainsKey("PNREF") ? responseNvp["PNREF"] : string.Empty; var result = responseNvp.ContainsKey("RESULT") ? responseNvp["RESULT"] : string.Empty; CreatePaymentOperationRecord(nvpRequest.ToString(), accountNum, securityCode, result, pnref, settings.Id, userContext, entityContext); return responseNvp; }
public static void Main(string[] Args) { Console.WriteLine("------------------------------------------------------"); Console.WriteLine("Executing Sample from File: XMLPaySale.cs"); Console.WriteLine("------------------------------------------------------"); // Sample Request. // Please replace [user], [vendor], [password] & [partner] with your merchant information. String Request = "<?xml version=\"1.0\"?><XMLPayRequest Timeout=\"45\" version=\"2.0\"><RequestData><Partner>[partner]</Partner><Vendor>[vendor]</Vendor><Transactions><Transaction><Sale><PayData><Invoice><TotalAmt Currency=\"USD\">25.12</TotalAmt><InvNum>INV12345</InvNum><BillTo><PONum>PO12345</PONum><Address><Street>123 Main St.</Street><Zip>12345</Zip></Address></BillTo></Invoice><Tender><Card><CardNum>5105105105105100</CardNum><ExpDate>202501</ExpDate></Card></Tender></PayData></Sale></Transaction></Transactions></RequestData><RequestAuth><UserPass><User>[user]</User><Password>[password]</Password></UserPass></RequestAuth></XMLPayRequest>"; // Create an instance of PayflowNETAPI. PayflowNETAPI PayflowNETAPI = new PayflowNETAPI(); // Can also pass the values in the constructor itself instead of using .config file. //PayflowNETAPI.SetParameters("pilot-payflowpro.paypal.com", 443, 45, "", 0, "", "", "enabled", "1", "payflow.log", "10240000", false); // RequestId is a unique string that is required for each & every transaction. // The merchant can use her/his own algorithm to generate this unique request id or // use the SDK provided API to generate this as shown below (PayflowUtility.RequestId). // // NOTE: Review the comments in the DoSaleComplete example under BasicTransactions for // more information on the Request ID. String Response = PayflowNETAPI.SubmitTransaction(Request, PayflowUtility.RequestId); // To write the Response on to the console. Console.WriteLine(Environment.NewLine + "Request = " + PayflowNETAPI.TransactionRequest); Console.WriteLine(Environment.NewLine + "Response = " + Response); // Following lines of code are optional. // Begin optional code for displaying SDK errors ... // It is used to read any errors that might have occurred in the SDK. // Get the transaction errors. String TransErrors = PayflowNETAPI.TransactionContext.ToString(); if (TransErrors != null && TransErrors.Length > 0) { Console.WriteLine(Environment.NewLine + "Transaction Errors from SDK = " + TransErrors); } Console.WriteLine(Environment.NewLine + "Status: " + PayflowUtility.GetStatus(Response)); Console.WriteLine(Environment.NewLine + "Press Enter to Exit ..."); Console.ReadLine(); }
public static void Main(string[] Args) { Console.WriteLine("------------------------------------------------------"); Console.WriteLine("Executing Sample from File: NVPSale.cs"); Console.WriteLine("------------------------------------------------------"); // Sample Request. // Please replace <user>, <vendor>, <password> & <partner> with your merchant information. //String Request = "USER=<user>&VENDOR=<vendor>&PARTNER=<partner>&PWD=<password>&TRXTYPE=S&ACCT=5105105105105100&EXPDATE=0125&TENDER=C&INVNUM=INV12345&AMT=25.12&PONUM=PO12345&STREET=123 Main St.&ZIP=12345"; String Request = "USER=toddprov4&VENDOR=toddprov4&PARTNER=VeriSign&PWD=password1&TRXTYPE=S&ORIGID=A50O0BE63815&EXPDATE=0125&TENDER=C&INVNUM=INV12345&AMT=25.12&PONUM=PO12345&STREET=123 Main St.&ZIP=12345"; // Create an instance of PayflowNETAPI. PayflowNETAPI PayflowNETAPI = new PayflowNETAPI(); // Can also pass the values in the constructor itself instead of using .config file. PayflowNETAPI.SetParameters("pilot-payflowpro.paypal.com", 443, 45, "", 0, "", "", "enabled", "1", "payflow.log", "10240000", false); // RequestId is a unique string that is required for each & every transaction. // The merchant can use her/his own algorithm to generate this unique request id or // use the SDK provided API to generate this as shown below (PayflowUtility.RequestId). // // NOTE: Review the comments in the DoSaleComplete example under BasicTransactions for // more information on the Request ID. String Response = PayflowNETAPI.SubmitTransaction(Request, PayflowUtility.RequestId); // To write the Response on to the console. Console.WriteLine(Environment.NewLine + "Request = " + PayflowNETAPI.TransactionRequest); Console.WriteLine(Environment.NewLine + "Response = " + Response); // Following lines of code are optional. // Begin optional code for displaying SDK errors ... // It is used to read any errors that might have occurred in the SDK. // Get the transaction errors. String TransErrors = PayflowNETAPI.TransactionContext.ToString(); if (TransErrors != null && TransErrors.Length > 0) { Console.WriteLine(Environment.NewLine + "Transaction Errors from SDK = " + TransErrors); } Console.WriteLine(Environment.NewLine + "Status: " + PayflowUtility.GetStatus(Response)); Console.WriteLine(Environment.NewLine + "Press Enter to Exit ..."); Console.ReadLine(); }
public PaymentResponse CreditCardPayment(CreditCardPaymentRequest req) { StringBuilder request = new StringBuilder(); request.Append($"TRXTYPE=S"); request.Append($"&ACCT={req.AccountNumber}"); request.Append($"&EXPDATE={req.Expiration.Replace("/", "")}"); request.Append($"&TENDER=C"); if (string.IsNullOrWhiteSpace(req.InvoiceNumber)) { req.InvoiceNumber = _confirmationNumberGenerator.GenerateConfirmationNumber(); } request.Append($"&INVNUM={Uri.EscapeDataString(req.InvoiceNumber)}"); request.Append($"&AMT={req.Amount:0.##}"); request.Append($"&USER={User}"); request.Append($"&VENDOR={Vendor}"); request.Append($"&PARTNER={Partner}"); request.Append($"&PWD={Password}"); if (string.IsNullOrWhiteSpace(req.Comment)) { request.Append($"&COMMENT1="); } else { request.Append($"&COMMENT1={Uri.EscapeDataString(req.Comment)}"); } if (req.BillingInformation != null) { if (!string.IsNullOrWhiteSpace(req.BillingInformation.BillToFirstName)) { request.Append($"&BILLTOFIRSTNAME={req.BillingInformation.BillToFirstName}"); } if (!string.IsNullOrWhiteSpace(req.BillingInformation.BillToLastName)) { request.Append($"&BILLTOLASTNAME={req.BillingInformation.BillToLastName}"); } if (!string.IsNullOrWhiteSpace(req.BillingInformation.BilingZipcode)) { request.Append($"&BILLTOZIP={req.BillingInformation.BilingZipcode}"); } if (!string.IsNullOrWhiteSpace(req.BillingInformation.BillingAddress)) { request.Append($"&BILLTOSTREET={req.BillingInformation.BillingAddress}"); } if (!string.IsNullOrWhiteSpace(req.BillingInformation.BillingCity)) { request.Append($"&BILLTOCITY={req.BillingInformation.BillingCity}"); } if (!string.IsNullOrWhiteSpace(req.BillingInformation.BillingState)) { request.Append($"&BILLTOSTATE={req.BillingInformation.BillingState}"); } } request.Append("&VERBOSITY=HIGH"); PayflowNETAPI PayflowNETAPI = new PayflowNETAPI(Host, Port, Timeout); string PayflowResponse = PayflowNETAPI.SubmitTransaction(request.ToString(), PayflowUtility.RequestId); var results = PayflowResponse.Split(new char[] { '&' }).Select(x => new { Name = x.Split('=')[0], Value = x.Split('=')[1] }); var RESPMSG = results.Where(x => x.Name == "RESPMSG").DefaultIfEmpty(null).Single(); if (RESPMSG != null) { if (RESPMSG.Value == "Approved") { return(new PaymentResponse { Amount = req.Amount, AuthCode = results.Where(x => x.Name == "AUTHCODE").DefaultIfEmpty(null).Single().Value, Transaction = results.Where(x => x.Name == "PNREF").DefaultIfEmpty(null).Single().Value, Success = true, Message = RESPMSG.Value, ProviderResponse = PayflowResponse }); } } return(new PaymentResponse { ProviderResponse = PayflowResponse, Amount = req.Amount, Message = RESPMSG == null ? "Payment Provider did not provide valid response" : RESPMSG.Value, ResponseText = RESPMSG == null ? "Payment Provider did not provide valid response" : RESPMSG.Value, Success = false, }); }
public static void Main(string[] Args) { Console.WriteLine("------------------------------------------------------"); Console.WriteLine("Executing Sample from File: XMLPayCommandLine_File.cs"); Console.WriteLine("------------------------------------------------------"); if (Args.Length < 4) { Console.WriteLine(Environment.NewLine + "Incorrect number of arguments. Usage:" + Environment.NewLine + "SamplesCS <hostAddress> <hostPort> <xml filename> <timeout> <proxyAddress> <proxyPort> <proxyLogon> <proxyPassword>"); Console.WriteLine(Environment.NewLine + "Example transaction:" + Environment.NewLine + "SamplesCS pilot-payflowpro.paypal.com 443 \"C:" + System.IO.Path.DirectorySeparatorChar + "Sale.xml\" 45"); Console.WriteLine(Environment.NewLine + "Press Enter to Exit ..."); Console.ReadLine(); System.Environment.Exit(-1); } PayflowNETAPI PayflowNETAPI; if (Args.Length == 4) { PayflowNETAPI = new PayflowNETAPI(Args[0], System.Convert.ToInt32(Args[1]), System.Convert.ToInt32(Args[3])); } else { PayflowNETAPI = new PayflowNETAPI(Args[0], System.Convert.ToInt32(Args[1]), System.Convert.ToInt32(Args[3]), Args[4], System.Convert.ToInt32(Args[5]), Args[6], Args[7]); } String XmlFile = ReadFile(Args[2]); if (XmlFile != null) { String ResponseStr = PayflowNETAPI.SubmitTransaction(XmlFile, PayflowUtility.RequestId); // To write the Response on to the console. Console.WriteLine(Environment.NewLine + "Request = " + PayflowNETAPI.TransactionRequest); Console.WriteLine(Environment.NewLine + "Response = " + ResponseStr); // Following lines of code are optional. // Begin optional code for displaying SDK errors ... // It is used to read any errors that might have occurred in the SDK. // Get the transaction errors. String TransErrors = PayflowNETAPI.TransactionContext.ToString(); if (TransErrors != null && TransErrors.Length > 0) { Console.WriteLine(Environment.NewLine + "Transaction Errors from SDK = " + TransErrors); } Console.WriteLine(Environment.NewLine + "Status: " + PayflowUtility.GetStatus(ResponseStr)); Console.WriteLine(Environment.NewLine + "Press Enter to Exit ..."); Console.ReadLine(); } else { Console.WriteLine(Environment.NewLine + "Press Enter to Exit ..."); Console.ReadLine(); } }
protected void Page_Load(object sender, EventArgs e) { if (Request.Form != null && Request.Form.AllKeys.Count() > 0) { businessName = ConfigurationManager.AppSettings["BusinessName"]; rawUrl = Request.RawUrl; string billaddress = Request.Form["Address"]; invoice = Request.Form["InvoiceNumber"]; string name = Request.Form["FirstName"] + " " + Request.Form["LastName"]; string address = Request.Form["City"] + "," + Request.Form["State"] + "," + Request.Form["Country"] + "," + Request.Form["Zip"]; string phno = Request.Form["PhoneNumber"]; email = Request.Form["EmailAddress"]; amt = Request.Form["Pleaseenteramount"]; business = Request.Form["YourBusinessName"]; if (!String.IsNullOrEmpty(email)) { string PayPalRequest = "TRXTYPE=S" //S - sale transaction + "&TENDER=C" //C - Credit card + "&ACCT=" + Request.Form["ctl00$ctl00$MainContent$LeftContent$cardNumber"] //card number + "&EXPDATE=" + Request.Form["ctl00$ctl00$MainContent$LeftContent$cardMonth"] + Request.Form["ctl00$ctl00$MainContent$LeftContent$cardYear"].Substring(2, 2) + "&CVV2=" + Request.Form["ctl00$ctl00$MainContent$LeftContent$cardSecurityCode"] //card validation value (card security code) + "&AMT=" + Request.Form["ctl00$ctl00$MainContent$LeftContent$ccAmount"] + "&COMMENT1=Payment for invoices" + "&FIRSTNAME=" + Request.Form["FirstName"] + "&LASTNAME=" + Request.Form["LastName"] + "&EMAIL=" + email + "&USER="******"USER"] + "&VENDOR=" + ConfigurationManager.AppSettings["VENDOR"] + "&PARTNER=" + ConfigurationManager.AppSettings["PARTNER"] + "&PWD=" + ConfigurationManager.AppSettings["PWD"]; // Create an instantce of PayflowNETAPI. PayflowNETAPI PayflowNETAPI = new PayflowNETAPI(); // RequestId is a unique string that is required for each & every transaction. // The merchant can use her/his own algorithm to generate this unique request id or // use the SDK provided API to generate this as shown below (PayflowUtility.RequestId). string PayPalResponse = PayflowNETAPI.SubmitTransaction(PayPalRequest, PayflowUtility.RequestId); //place data from PayPal into a namevaluecollection NameValueCollection RequestCollection = GetPayPalCollection(PayflowNETAPI.TransactionRequest); NameValueCollection ResponseCollection = GetPayPalCollection(PayPalResponse); string requestCollection = ShowPayPalInfo(RequestCollection); Session["RequestCollection"] = requestCollection; string responseCollection = ShowPayPalInfo(ResponseCollection); Session["ResponseCollection"] = responseCollection; //show transaction errors if any string TransErrors = PayflowNETAPI.TransactionContext.ToString(); Session["TransErrors"] = TransErrors; Session["PayPalResponse"] = PayPalResponse; string status = PayflowUtility.GetStatus(PayPalResponse).ToString(); ExceptionUtils.WriteTransactionMessage(ResponseCollection, status, email, business); if (status == "Transaction Successful.") { StringBuilder sb = new StringBuilder(); sb.Append("<HTML><BODY><Font face='Arial'>"); sb.Append("Hi " + business + ",<br><br>"); sb.Append("Thanks for prompt payment. We appreciate your business and look forward to continued business with you in the future.<br>"); sb.Append("If you have any questions please do not hesitate to contact our invoice team at <a href='mailto:[email protected]'>[email protected]</a>. we will be glad to help you.<br><br>"); sb.Append("<strong>PAYMENT DETAILS</strong>"); sb.Append("<TABLE><TR><TD>Transaction ID:</TD><TD>" + TransactionID(email) + "</TD></TR>"); sb.Append("<TR><TD>Business Name:</TD><TD>" + business + "</TD></TR>"); sb.Append("<TR><TD>Invoice Number:</TD><TD>" + invoice + "</TD></TR>"); sb.Append("<TR><TD>Amount:</TD><TD>" + amt + "</TD></TR>"); sb.Append("<TR><TD>Address:</TD><TD>" + billaddress + "," + address + "</TD></TR>"); sb.Append("<TR><TD>Phone Number:</TD><TD>" + phno + "</TD></TR>"); sb.Append("<TR><TD>Email:</TD><TD>" + email + "</TD></TR>"); sb.Append("</TABLE></Font></BODY></HTML>"); try { string subject = "Thank you - Ameex received Your Payment!"; Email(email, subject, sb.ToString(), "PaymentEmailTo".GetAppKeyString()); } catch (Exception ex) { ExceptionUtils.WriteError(ex); } } else { StringBuilder sb = new StringBuilder(); sb.Append("<HTML><BODY><Font face='Arial'>"); sb.Append("Hi " + business + ",<br><br>"); sb.Append("We apologize that your recent transaction to Ameex has failed due to some technical reasons. The reasons for the failure are mentioned below. You can retry the payment through our <a href='https://ameexusa.com/Online-Payment/'>online payment page<a>. If you have any queries, please <a href='mailto:[email protected]'>contact our invoice team</a>. We are more than happy to help you.<br><br>"); sb.Append("<strong>PAYMENT DETAILS</strong>"); sb.Append("<TABLE><TR><TD>Transaction ID:</TD><TD>" + TransactionID(email) + "</TD></TR>"); sb.Append("<TR><TD>Business Name:</TD><TD>" + business + "</TD></TR>"); sb.Append("<TR><TD>Email ID:</TD><TD>" + email + "</TD></TR>"); sb.Append("<TR><TD>" + responseCollection + "</TD></TR>"); sb.Append("<TR><TD>" + TransErrors + "</TD></TR>"); sb.Append("</TABLE><br/>Regards,<br/>Accounts Team,<br/>Ameex Technologies Corp.<br/>1701 E Wood field Rd, Suite 710<br/>Schaumburg, IL 60173. USA.<br/></Font></BODY></HTML>"); try { string subject = "Your payment to Ameex is failed due to some technical reasons"; Email(email, subject, sb.ToString(), "PaymentEmailTo".GetAppKeyString()); } catch (Exception ex) { ExceptionUtils.WriteError(ex); } } if (status == "Transaction Successful.") { StringBuilder sb = new StringBuilder(); sb.Append("<HTML><BODY><Font face='Arial'>"); sb.Append("Accounts Team,<br><br>"); sb.Append("We have received a new payment from " + business + ". Kindly verify and acknowledge.<br><br>"); sb.Append("<strong>PAYMENT DETAILS</strong>"); sb.Append("<TABLE><TR><TD>Transaction ID:</TD><TD>" + TransactionID(email) + "</TD></TR>"); sb.Append("<TR><TD>Business Name:</TD><TD>" + business + "</TD></TR>"); sb.Append("<TR><TD>Invoice Number:</TD><TD>" + invoice + "</TD></TR>"); sb.Append("<TR><TD>Amount:</TD><TD>" + amt + "</TD></TR>"); sb.Append("<TR><TD>Address:</TD><TD>" + billaddress + "," + address + "</TD></TR>"); sb.Append("<TR><TD>Phone Number:</TD><TD>" + phno + "</TD></TR>"); sb.Append("<TR><TD>Email:</TD><TD>" + email + "</TD></TR>"); sb.Append("</TABLE></Font></BODY></HTML>"); try { string subject = "Payment received from " + business; Email("PaymentEmailTo".GetAppKeyString(), subject, sb.ToString(), ""); } catch (Exception ex) { ExceptionUtils.WriteError(ex); } } else { StringBuilder sb = new StringBuilder(); sb.Append("<HTML><BODY><Font face='Arial'>"); sb.Append("Accounts Team,<br><br>"); sb.Append("A Client (" + business + ") has tried to make payment in our online portal, but failed. Please reach out to the client and assist in making the payment. The failed payment details are,<br><br>"); sb.Append("<strong>PAYMENT DETAILS</strong>"); sb.Append("<TABLE><TR><TD>Transaction ID:</TD><TD>" + TransactionID(email) + "</TD></TR>"); sb.Append("<TR><TD>Business Name:</TD><TD>" + business + "</TD></TR>"); sb.Append("<TR><TD>Email ID:</TD><TD>" + email + "</TD></TR>"); sb.Append("<TR><TD>" + responseCollection + "</TD></TR>"); sb.Append("<TR><TD>" + TransErrors + "</TD></TR>"); sb.Append("</TABLE></Font></BODY></HTML>"); try { string subject = "Transaction Failure for " + business; Email("PaymentEmailTo".GetAppKeyString(), subject, sb.ToString(), ""); } catch (Exception ex) { ExceptionUtils.WriteError(ex); } } } } }