public static string CreatePayPage(PayPageRequest objPayPageRequest) { return("merchant_email=" + objPayPageRequest.MerchantEmail + "&secret_key=" + objPayPageRequest.SecretKey + "¤cy=" + objPayPageRequest.Currency + "&amount=" + objPayPageRequest.Amount + "&site_url=" + objPayPageRequest.SiteUrl + "&title=" + objPayPageRequest.ProductsPerTitle + "&quantity=" + objPayPageRequest.Quantity + "&unit_price=" + objPayPageRequest.UnitPrice + "&products_per_title=" + objPayPageRequest.ProductsPerTitle + "&return_url=" + objPayPageRequest.SiteUrl + "&cc_first_name=" + objPayPageRequest.CcFirstNname + "&cc_last_name=" + objPayPageRequest.CcLastName + "&cc_phone_number=" + objPayPageRequest.CcPhoneNumber + "&phone_number=" + objPayPageRequest.CcPhoneNumber + "&billing_address=" + objPayPageRequest.BillingAddress + "&city=" + objPayPageRequest.City + "&state=" + objPayPageRequest.State + "&postal_code=" + objPayPageRequest.PostalCode + "&country=" + objPayPageRequest.Country + "&email=" + objPayPageRequest.Email + "&ip_customer=" + System.Net.Dns.GetHostName() + "&ip_merchant=100.100.100.100" + "&address_shipping=" + objPayPageRequest.AddressShipping + "&city_shipping=" + objPayPageRequest.CityShipping + "&state_shipping=" + objPayPageRequest.StateShipping + "&postal_code_shipping=" + objPayPageRequest.PostalCodeShipping + "&country_shipping=" + objPayPageRequest.CountryShipping + "&other_charges=0" + "&discount=0" + "&reference_no=" + GenerateReferenceNumber() + "&msg_lang=English" + "&cms_with_version=API"); }
public static string PayTabMethod(PayPageRequest objrequest) { var tmp = new PayPageResonse(); try { string serviceResponse = MakeWebServiceCall("create_pay_page", CreatePayPage(objrequest)); tmp = JsonConvert.DeserializeObject <PayPageResonse>(serviceResponse); if (tmp.response_code != null && tmp.response_code != "4012") { //code } else if (tmp.payment_url != "") { return(tmp.payment_url); } return("error"); } catch (System.Net.WebException ex) { return(ex.Message); } catch (Exception ex) { return(ex.Message); } }
public static string PayMethod(int Pay, string ReturnUrl, string Currency, string ItemName, string Paid, string Fname = null, string Lname = null, string Email = null, string Phone = null, string City = null, string CountryCode = null, string ItemDescription = null, string ItemCode = null, string CancelUrl = null) { if (Pay == 1) { #region Payza ServicePointManager.Expect100Continue = true; ServicePointManager.ServerCertificateValidationCallback = delegate { return(true); }; ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12 | SecurityProtocolType.Ssl3; string URL = PayZaMethod(PayZaEmail, PayZaPassword, PayZaWebsiteURL, "other", ItemName, ItemDescription, ItemCode, Convert.ToDouble(Paid), Currency, 0, 0, 0, ReturnUrl, CancelUrl, "No Info", "No Info", "No Info", "No Info", "No Info", "No Info"); if (URL != null) { try { string Token = URL.Split('&')[2]; return("https://secure.payza.com/checkout?ap_productid=" + Token.Substring(6) + "&ap_testmode=" + TestMode + "&ap_quantity=1"); } catch { return("error"); } } else { return("error"); } #endregion } else if (Pay == 2) { #region PayTab var objrequest = new PayPageRequest(); objrequest.MerchantEmail = PayTabMerchantEmail; objrequest.SecretKey = PayTabSecretKey; objrequest.Currency = Currency; objrequest.Amount = Paid; objrequest.SiteUrl = PayTabWebsiteURL; objrequest.Title = ItemName; objrequest.Quantity = "1"; objrequest.UnitPrice = Paid; objrequest.ProductsPerTitle = ItemName; objrequest.ReturnUrl = ReturnUrl; objrequest.CcFirstNname = Fname; objrequest.CcLastName = Lname; objrequest.CcPhoneNumber = Phone; objrequest.Phonenumber = Phone; objrequest.BillingAddress = City; objrequest.City = City; objrequest.State = City; objrequest.PostalCode = "32512"; objrequest.Country = CountryCode; objrequest.Email = Email; objrequest.AddressShipping = City; objrequest.CityShipping = City; objrequest.StateShipping = City; objrequest.PostalCodeShipping = "32512"; objrequest.CountryShipping = CountryCode; objrequest.PaymentReference = GenerateReferenceNumber(); objrequest.PaymentDate = DateTime.Now; return(PayTabMethod(objrequest)); #endregion } return(""); }