public ActionResult EnterAmount(DonationAmountViewModel userInput) { Instamojo objClass = InstamojoImplementation.getApi(PaymentGatewaySecrets.CLIENT_ID, PaymentGatewaySecrets.CLIENT_SECRET, PaymentGatewaySecrets.API_ENDPOINT, PaymentGatewaySecrets.AUTH_ENDPOINT); PaymentOrder objPaymentRequest = new PaymentOrder() { name = userInput.Name, email = userInput.Email, phone = userInput.PhoneNumber, amount = userInput.Amount, transaction_id = Guid.NewGuid().ToString(), redirect_url = "http://localhost:59701/Donate/PaymentMade" }; if (objPaymentRequest.validate()) { if (objPaymentRequest.emailInvalid) { ModelState.AddModelError("", "Email is invalid"); } if (objPaymentRequest.nameInvalid) { ModelState.AddModelError("", "Name is invalid"); } if (objPaymentRequest.phoneInvalid) { ModelState.AddModelError("", "Phone Number is invalid"); } if (objPaymentRequest.amountInvalid) { ModelState.AddModelError("", "Amount is invalid"); } if (objPaymentRequest.currencyInvalid) { ModelState.AddModelError("", "Currency is invalid"); } if (objPaymentRequest.transactionIdInvalid) { ModelState.AddModelError("", "Transaction ID is invalid"); } if (objPaymentRequest.redirectUrlInvalid) { ModelState.AddModelError("", "URL is invalid"); } if (objPaymentRequest.webhookUrlInvalid) { ModelState.AddModelError("", "Webhook is invalid"); } } else { CreatePaymentOrderResponse objPaymentResponse = objClass.createNewPaymentRequest(objPaymentRequest); return(Redirect(objPaymentResponse.payment_options.payment_url)); } return(View()); }
static void CreatePaymentOrder_whenWebhookIsInvalid(Instamojo objClass) { PaymentOrder objPaymentRequest = new PaymentOrder(); objPaymentRequest.email = "*****@*****.**"; objPaymentRequest.name = "Test Name"; objPaymentRequest.description = "Test Description"; objPaymentRequest.phone = "9334556657"; objPaymentRequest.amount = 100; objPaymentRequest.currency = "INR"; string randomName = Path.GetRandomFileName(); randomName = randomName.Replace(".", string.Empty); objPaymentRequest.transaction_id = "test" + randomName; objPaymentRequest.redirect_url = "https://swaggerhub.com/api/saich/pay-with-instamojo/1.0.0"; objPaymentRequest.webhook_url = "invalid web hook url"; //Extra POST parameters if (objPaymentRequest.validate()) { if (objPaymentRequest.emailInvalid) { MessageBox.Show("Email is not valid"); } if (objPaymentRequest.nameInvalid) { MessageBox.Show("Name is not valid"); } if (objPaymentRequest.phoneInvalid) { MessageBox.Show("Phone is not valid"); } if (objPaymentRequest.amountInvalid) { MessageBox.Show("Amount is not valid"); } if (objPaymentRequest.currencyInvalid) { MessageBox.Show("Currency is not valid"); } if (objPaymentRequest.transactionIdInvalid) { MessageBox.Show("Transaction Id is not valid"); } if (objPaymentRequest.redirectUrlInvalid) { MessageBox.Show("Redirect Url Id is not valid"); } if (objPaymentRequest.webhookUrlInvalid) { MessageBox.Show("Webhook URL is not valid"); } } }
public CreatePaymentOrderResponse CreateNewPaymentRequest(PaymentOrder objPaymentRequest) { if (objPaymentRequest == null) { throw new ArgumentNullException(typeof(PaymentOrder).Name, "PaymentOrder Object Can not be Null "); } bool isInValid = objPaymentRequest.validate(); if (isInValid) { throw new InvalidPaymentOrderException(); } try { string stream = api_call("POST", "gateway/orders/", objPaymentRequest); CreatePaymentOrderResponse objPaymentCreateResponse = JsonConvert.DeserializeObject <CreatePaymentOrderResponse>(stream); return(objPaymentCreateResponse); } catch (IOException ex) { throw new IOException(ex.Message, ex.InnerException); } catch (BaseException ex) { throw new BaseException(ex.Message, ex.InnerException); } catch (UriFormatException ex) { throw new UriFormatException(ex.Message, ex.InnerException); } catch (WebException ex) { if (ex.Status == WebExceptionStatus.ProtocolError) { HttpWebResponse err = ex.Response as HttpWebResponse; if (err != null) { string htmlResponse = new StreamReader(err.GetResponseStream()).ReadToEnd(); throw new InvalidPaymentOrderException(htmlResponse); } } throw new WebException(ex.Message, ex.InnerException); } catch (Exception ex) { throw new Exception(ex.Message, ex.InnerException); } }
static void CreatePaymentOrder_whenInvalidPaymentOrderIsMade(Instamojo objClass) { PaymentOrder objPaymentRequest = new PaymentOrder(); // objPaymentRequest.email = "*****@*****.**"; objPaymentRequest.phone = "9969156561"; objPaymentRequest.amount = 9; objPaymentRequest.currency = "USD"; string randomName = Path.GetRandomFileName(); randomName = randomName.Replace(".", string.Empty); objPaymentRequest.transaction_id = "test" + randomName; objPaymentRequest.redirect_url = "https://swaggerhub.com/api/saich/pay-with-instamojo/1.0.0"; //Extra POST parameters if (objPaymentRequest.validate()) { if (objPaymentRequest.emailInvalid) { MessageBox.Show("Email is not valid"); } if (objPaymentRequest.nameInvalid) { MessageBox.Show("Name is not valid"); } if (objPaymentRequest.phoneInvalid) { MessageBox.Show("Phone is not valid"); } if (objPaymentRequest.amountInvalid) { MessageBox.Show("Amount is not valid"); } if (objPaymentRequest.currencyInvalid) { MessageBox.Show("Currency is not valid"); } if (objPaymentRequest.transactionIdInvalid) { MessageBox.Show("Transaction Id is not valid"); } if (objPaymentRequest.redirectUrlInvalid) { MessageBox.Show("Redirect Url Id is not valid"); } } }
public PaymentResponseModel CreatePaymentOrder(int loginid, string ordernumber, int storeid) { PaymentResponseModel response = new PaymentResponseModel(); string transaction_id = ""; string OrderNumber = ""; using (sjb_androidEntities context = new sjb_androidEntities()) { var orderDetails = (from r in context.registrationmasters join o in context.ordermasters on r.LoginID equals o.LoginId where r.LoginID == loginid && o.OrderNumber == ordernumber && o.StoreId == storeid select new PaymentGatewayModel() { name = r.Name, phone = r.PhoneNumber, email = r.EmailID, description = o.OrderNumber, amount = (double)o.NetAmount }).First(); //For Production //string Insta_client_id = "YPmEwDVMbYy4hH9EZOcY4Vsw3xJWjnAd3qlTS85J", // Insta_client_secret = "fSiNKEG8PRLdOXSzpQrBba02Ix1sfbxDSHg3f562AFY0YqvgKXMm70wbE6vqxzmmpVOKB1MyG3tlwDzX4rzNXwRwqaHVafFQv1gkj4kNf14x1eeync9PoMuGtOulBxJk", // Insta_Endpoint = InstamojoConstants.INSTAMOJO_API_ENDPOINT, // Insta_Auth_Endpoint = InstamojoConstants.INSTAMOJO_AUTH_ENDPOINT; //For Test string Insta_client_id = ""; string Insta_client_secret = ""; string Insta_Endpoint = ""; string Insta_Auth_Endpoint = ""; if (storeid == 1) { Insta_client_id = "HhWceDXORiCKCKIechUmXZX6vd4nj44kKvCUIVJv"; Insta_client_secret = "5B6CAfNsEoaakuzWLia7CMtgFsp6gt0MTrN5jR0MzsTIerNXKjmS9k1bBS1J8LdANjKXWtmlR1RuiOM8o71JVYYawBCl4NRiWbpKrI8OwkwnjNlvOuYRnjfkGnjozZDM"; Insta_Endpoint = InstamojoConstants.INSTAMOJO_API_ENDPOINT; Insta_Auth_Endpoint = InstamojoConstants.INSTAMOJO_AUTH_ENDPOINT; } if (storeid == 2) { Insta_client_id = "tmLkZZ0zV41nJwhayBGBOI4m4I7bH55qpUBdEXGS"; Insta_client_secret = "IDejdccGqKaFlGav9bntKULvMZ0g7twVFolC9gdrh9peMS0megSFr7iDpWwWIDgFUc3W5SlX99fKnhxsoy6ipdAv9JeQwebmOU6VRvOEQnNMWwZnWglYmDGrfgKRheXs"; Insta_Endpoint = InstamojoConstants.INSTAMOJO_API_ENDPOINT; Insta_Auth_Endpoint = InstamojoConstants.INSTAMOJO_AUTH_ENDPOINT; } if (storeid == 3) { Insta_client_id = "tmLkZZ0zV41nJwhayBGBOI4m4I7bH55qpUBdEXGS"; Insta_client_secret = "IDejdccGqKaFlGav9bntKULvMZ0g7twVFolC9gdrh9peMS0megSFr7iDpWwWIDgFUc3W5SlX99fKnhxsoy6ipdAv9JeQwebmOU6VRvOEQnNMWwZnWglYmDGrfgKRheXs"; Insta_Endpoint = InstamojoConstants.INSTAMOJO_API_ENDPOINT; Insta_Auth_Endpoint = InstamojoConstants.INSTAMOJO_AUTH_ENDPOINT; } InstamojoAPI.Instamojo objClass = InstamojoImplementation.getApi(Insta_client_id, Insta_client_secret, Insta_Endpoint, Insta_Auth_Endpoint); PaymentOrder objPaymentRequest = new PaymentOrder(); //Required POST parameters objPaymentRequest.name = orderDetails.name; objPaymentRequest.email = orderDetails.email; objPaymentRequest.phone = orderDetails.phone; objPaymentRequest.description = orderDetails.description; objPaymentRequest.amount = orderDetails.amount; objPaymentRequest.currency = "INR"; string randomName = Path.GetRandomFileName(); randomName = randomName.Replace(".", string.Empty); objPaymentRequest.transaction_id = "EVG" + randomName; transaction_id = objPaymentRequest.transaction_id; OrderNumber = objPaymentRequest.description; //For Production //objPaymentRequest.redirect_url = "http://103.233.79.234:1000/"; //objPaymentRequest.webhook_url = "https://your.server.com/webhook"; //Extra POST parameters //For Test objPaymentRequest.redirect_url = "https://swaggerhub.com/api/saich/pay-with-instamojo/1.0.0"; objPaymentRequest.webhook_url = "https://your.server.com/webhook"; if (objPaymentRequest.validate()) { //if (objPaymentRequest.emailInvalid) //{ // response.Message = "Email is not valid"; //} //if (objPaymentRequest.nameInvalid) //{ // response.Message = "Name is not valid"; //} if (objPaymentRequest.phoneInvalid) { response.Message = "Phone is not valid"; } if (objPaymentRequest.amountInvalid) { response.Message = "Amount is not valid"; } if (objPaymentRequest.currencyInvalid) { response.Message = "Currency is not valid"; } if (objPaymentRequest.transactionIdInvalid) { response.Message = "Transaction Id is not valid"; } if (objPaymentRequest.redirectUrlInvalid) { response.Message = "Redirect Url Id is not valid"; } if (objPaymentRequest.webhookUrlInvalid) { response.Message = "Webhook URL is not valid"; } } else { try { CreatePaymentOrderResponse objPaymentResponse = objClass.createNewPaymentRequest(objPaymentRequest); response.PaymentURL = objPaymentResponse.payment_options.payment_url; var data = context.ordermasters.Where(x => x.LoginId == loginid && x.OrderNumber == ordernumber && x.StoreId == storeid).FirstOrDefault(); if (data != null) { context.ordermasters.Where(x => x.LoginId == loginid && x.OrderNumber == ordernumber && x.StoreId == storeid).ToList().ForEach(x => x.TranactionId = transaction_id); context.SaveChanges(); } } catch (ArgumentNullException ex) { response.Message = ex.Message; } catch (WebException ex) { response.Message = ex.Message; } catch (IOException ex) { response.Message = ex.Message; } catch (InvalidPaymentOrderException ex) { if (!ex.IsWebhookValid()) { response.Message = "Webhook is invalid"; } if (!ex.IsCurrencyValid()) { response.Message = "Currency is Invalid"; } if (!ex.IsTransactionIDValid()) { response.Message = "Transaction ID is Invalid"; } } catch (ConnectionException ex) { response.Message = ex.Message; } catch (BaseException ex) { response.Message = ex.Message; } catch (Exception ex) { response.Message = ex.Message; } } } return(response); }
public ActionResult CreateOrder(Models.PaymentInitiateModel paymentData) { // We can validate the payment data using dataAnnotation on model // Using random we crate the transaction id of payment Random randomObj = new Random(); string transactionId = randomObj.Next(10000000, 100000000).ToString(); // Create instamojo Clint Id and Secret Instamojo objClass = InstamojoImplementation.getApi(instamojoClientId, instamojoSecretId, endpoint, auth_endpoint); PaymentOrder objPaymentRequest = new PaymentOrder(); //Required POST parameters objPaymentRequest.name = paymentData.name; objPaymentRequest.email = paymentData.email; objPaymentRequest.phone = paymentData.contactNumber; objPaymentRequest.amount = paymentData.amount; objPaymentRequest.transaction_id = transactionId; // Unique Id to be provided . This unique id we have to create // Redirect url is for when transaction completed than payment gateway redirected to this url // Let's set the redirecturl // Create Complete Controller function objPaymentRequest.redirect_url = "http://localhost:64200/payment/complete"; //webhook is optional. this is used for when payment completed instamojo hit this api for giving the reponse of payment // objPaymentRequest.webhook_url = "https://your.server.com/webhook"; // Validate the order data if (objPaymentRequest.validate()) { // Email is not valid if (objPaymentRequest.emailInvalid) { } //Name is not valid if (objPaymentRequest.nameInvalid) { } //Phone is not valid if (objPaymentRequest.phoneInvalid) { } //Amount is not valid if (objPaymentRequest.amountInvalid) { } //Currency is not valid if (objPaymentRequest.currencyInvalid) { } //Transaction Id is not valid if (objPaymentRequest.transactionIdInvalid) { } //Redirect Url Id is not valid if (objPaymentRequest.redirectUrlInvalid) { } // Webhook URL is not valid if (objPaymentRequest.webhookUrlInvalid) { } } else { try { // Create the order and it will reurn payment url and instmojo order id CreatePaymentOrderResponse objPaymentResponse = objClass.createNewPaymentRequest(objPaymentRequest); // Instmojo order id you can save this wihth user data in db for verification on payment verification time string orderId = objPaymentResponse.order.id; string paymentUrl = objPaymentResponse.payment_options.payment_url; // Return on payment url return(Redirect(paymentUrl)); } catch (ArgumentNullException ex) { } catch (WebException ex) { } catch (IOException ex) { } catch (InvalidPaymentOrderException ex) { if (!ex.IsWebhookValid()) { } if (!ex.IsCurrencyValid()) { } if (!ex.IsTransactionIDValid()) { } } catch (ConnectionException ex) { } catch (BaseException ex) { } catch (Exception ex) { } } return(View("")); }
private string CreatePaymentOrder(Instamojo objClass) { var message = ""; CreatePaymentOrderResponse objPaymentResponse = null; PaymentOrder objPaymentRequest = new PaymentOrder(); //////////////////// /// /* * objPaymentRequest.name = "ABCD"; * objPaymentRequest.email = "*****@*****.**"; * objPaymentRequest.phone = "0123456789"; * objPaymentRequest.amount = 9; * objPaymentRequest.transaction_id = "test"; // Unique Id to be provided * * objPaymentRequest.redirect_url = “redirect_url”; */ /////////////////// //Required POST parameters objPaymentRequest.name = Name.Value; // "ABCD"; objPaymentRequest.email = Email.Value; // "*****@*****.**"; objPaymentRequest.phone = Phone.Value; // "9920024852"; objPaymentRequest.description = "Payment From " + Name.Value; // "Test description"; objPaymentRequest.amount = Convert.ToInt64(txtAmount.Value); //objPaymentRequest.currency = "USD"; string randomName = Path.GetRandomFileName(); randomName = randomName.Replace(".", string.Empty); objPaymentRequest.transaction_id = randomName; // DateTime.Now.ToString().Replace("-", "").Replace(":", "").Replace(" ", ""); objPaymentRequest.redirect_url = ConfigurationManager.AppSettings["RedirectUrl"]; // "https://ettest.ttpsolutions.in/index.html#/PaymentOnline"; objPaymentRequest.webhook_url = ConfigurationManager.AppSettings["WebhookUrl"]; // "https://your.server.com/webhook"; //Extra POST parameters if (objPaymentRequest.validate()) { if (objPaymentRequest.emailInvalid) { writelog("Email is not valid"); } else if (objPaymentRequest.nameInvalid) { writelog("Name is not valid"); } else if (objPaymentRequest.phoneInvalid) { writelog("Phone is not valid"); } else if (objPaymentRequest.amountInvalid) { writelog("Amount is not valid"); } else if (objPaymentRequest.currencyInvalid) { writelog("Currency is not valid"); } else if (objPaymentRequest.transactionIdInvalid) { writelog("Transaction Id is not valid"); } else if (objPaymentRequest.redirectUrlInvalid) { writelog("Redirect Url Id is not valid"); } else if (objPaymentRequest.webhookUrlInvalid) { writelog("Webhook URL is not valid"); } } else { try { db = new EphraimTradersEntities(); objPaymentResponse = objClass.createNewPaymentRequest(objPaymentRequest); message = objPaymentResponse.payment_options.payment_url; } catch (ArgumentNullException ex) { writelog(ex.Message); } catch (WebException ex) { writelog(ex.Message); } catch (IOException ex) { writelog(ex.Message); } catch (InvalidPaymentOrderException ex) { if (!ex.IsWebhookValid()) { writelog("Webhook is invalid"); } if (!ex.IsCurrencyValid()) { writelog("Currency is Invalid"); } if (!ex.IsTransactionIDValid()) { writelog("Transaction ID is Inavlid"); } } catch (ConnectionException ex) { writelog(ex.Message); } catch (BaseException ex) { writelog(ex.Message); } catch (Exception ex) { writelog("Error:" + ex.Message); } } return(message); }
void instamojopay() { /***** Create a new payment order *******/ string ClientID = "lm0yIbueCMdnyDtG8IG2FFwNbDG4TwcCzu2uSYsT"; string secretkey = "F8MsK5hAZ8IMgKwp9JmAkpNMfEREFMtM9dnMqECCzaP3xGnVJwhAJs0Ks1G2Iy8slOmvoy6p8ehZpjwpT1VuhDpKoMyCgU8fUHOaSZZuUlMs05OW6eGJGvrokPAuAuIY"; string endpoint = "https://api.instamojo.com/v2/"; string authendpoint = "https://www.instamojo.com/oauth2/token/"; Instamojo objClass = InstamojoImplementation.getApi(ClientID, secretkey, endpoint, authendpoint); PaymentOrder objPaymentRequest = new PaymentOrder(); //Required POST parameters objPaymentRequest.name = inputname.Text; objPaymentRequest.email = "*****@*****.**"; objPaymentRequest.phone = inputphone.Text; objPaymentRequest.amount = Convert.ToDouble(total.Text); objPaymentRequest.transaction_id = bookingid.Text; // Unique Id to be provided objPaymentRequest.redirect_url = "http://localhost:51150/payment.aspx"; //webhook is optional. //objPaymentRequest.webhook_url = "https://your.server.com/webhook"; if (objPaymentRequest.validate()) { if (objPaymentRequest.nameInvalid) { Response.Write("<script LANGUAGE='JavaScript' >alert('Name is not valid')</script>"); } if (objPaymentRequest.phoneInvalid) { Response.Write("<script LANGUAGE='JavaScript' >alert('Phone is not valid')</script>"); } if (objPaymentRequest.redirectUrlInvalid) { Response.Write("<script LANGUAGE='JavaScript' >alert('Redirect Url Id is not valid')</script>"); } } else { try { CreatePaymentOrderResponse objPaymentResponse = objClass.createNewPaymentRequest(objPaymentRequest); //objPaymentRequest.redirect_url = "www.google.com"; Response.Write("Payment URL = " + objPaymentResponse.payment_options.payment_url); Response.Redirect(objPaymentResponse.payment_options.payment_url); } catch (ArgumentNullException ex) { Response.Write("<script LANGUAGE='JavaScript' >alert('" + ex.Message + "')</script>"); } catch (IOException ex) { Response.Write("<script LANGUAGE='JavaScript' >alert('" + ex.Message + "')</script>"); } catch (InvalidPaymentOrderException ex) { if (!ex.IsWebhookValid()) { Response.Write("<script LANGUAGE='JavaScript' >alert('" + ex.Message + "')</script>"); } } catch (ConnectionException ex) { Response.Write("<script LANGUAGE='JavaScript' >alert('" + ex.Message + "')</script>"); } catch (BaseException ex) { Response.Write("<script LANGUAGE='JavaScript' >alert('" + ex.Message + "')</script>"); } catch (Exception ex) { Response.Write("<script LANGUAGE='JavaScript' >alert('Error:' " + ex.Message + "')</script>"); } } }
private void CreatePaymentOrder(Instamojo objClass) { PaymentOrder objPaymentRequest = new PaymentOrder(); //Required POST parameters objPaymentRequest.name = txtName.Text; objPaymentRequest.email = txtEmail.Text; objPaymentRequest.phone = txtMobileNumber.Text; objPaymentRequest.description = "Test description"; objPaymentRequest.amount = Convert.ToInt32(txtAmount.Text); objPaymentRequest.currency = "INR"; string randomName = Path.GetRandomFileName(); randomName = randomName.Replace(".", string.Empty); objPaymentRequest.transaction_id = "test" + randomName; Session["transID"] = objPaymentRequest.transaction_id; objPaymentRequest.redirect_url = "https://localhost:44337/CallBackInstamojo.aspx"; //Extra POST parameters if (objPaymentRequest.validate()) { if (objPaymentRequest.emailInvalid) { Response.Write("Email is not valid"); } if (objPaymentRequest.nameInvalid) { Response.Write("Name is not valid"); } if (objPaymentRequest.phoneInvalid) { Response.Write("Phone is not valid"); } if (objPaymentRequest.amountInvalid) { Response.Write("Amount is not valid"); } if (objPaymentRequest.currencyInvalid) { Response.Write("Currency is not valid"); } if (objPaymentRequest.transactionIdInvalid) { Response.Write("Transaction Id is not valid"); } if (objPaymentRequest.redirectUrlInvalid) { Response.Write("Redirect Url Id is not valid"); } if (objPaymentRequest.webhookUrlInvalid) { Response.Write("Webhook URL is not valid"); } } else { try { CreatePaymentOrderResponse objPaymentResponse = objClass.createNewPaymentRequest(objPaymentRequest); Response.Redirect(objPaymentResponse.payment_options.payment_url); } catch (ArgumentNullException ex) { Response.Write(ex.Message); } catch (WebException ex) { Response.Write(ex.Message); } catch (IOException ex) { Response.Write(ex.Message); } catch (InvalidPaymentOrderException ex) { if (!ex.IsWebhookValid()) { Response.Write("Webhook is invalid"); } if (!ex.IsCurrencyValid()) { Response.Write("Currency is Invalid"); } if (!ex.IsTransactionIDValid()) { Response.Write("Transaction ID is Inavlid"); } } catch (ConnectionException ex) { Response.Write(ex.Message); } catch (BaseException ex) { Response.Write(ex.Message); } catch (Exception ex) { Response.Write("Error:" + ex.Message); } } }
static void CreatePaymentOrder(Instamojo objClass) { PaymentOrder objPaymentRequest = new PaymentOrder(); //Required POST parameters objPaymentRequest.name = "ABCD"; objPaymentRequest.email = "*****@*****.**"; objPaymentRequest.phone = "9969156561"; objPaymentRequest.description = "Test description"; objPaymentRequest.amount = 9; objPaymentRequest.currency = "USD"; string randomName = Path.GetRandomFileName(); randomName = randomName.Replace(".", string.Empty); objPaymentRequest.transaction_id = "test" + randomName; objPaymentRequest.redirect_url = "https://swaggerhub.com/api/saich/pay-with-instamojo/1.0.0"; objPaymentRequest.webhook_url = "https://your.server.com/webhook"; //Extra POST parameters if (objPaymentRequest.validate()) { if (objPaymentRequest.emailInvalid) { MessageBox.Show("Email is not valid"); } if (objPaymentRequest.nameInvalid) { MessageBox.Show("Name is not valid"); } if (objPaymentRequest.phoneInvalid) { MessageBox.Show("Phone is not valid"); } if (objPaymentRequest.amountInvalid) { MessageBox.Show("Amount is not valid"); } if (objPaymentRequest.currencyInvalid) { MessageBox.Show("Currency is not valid"); } if (objPaymentRequest.transactionIdInvalid) { MessageBox.Show("Transaction Id is not valid"); } if (objPaymentRequest.redirectUrlInvalid) { MessageBox.Show("Redirect Url Id is not valid"); } if (objPaymentRequest.webhookUrlInvalid) { MessageBox.Show("Webhook URL is not valid"); } } else { try { CreatePaymentOrderResponse objPaymentResponse = objClass.createNewPaymentRequest(objPaymentRequest); MessageBox.Show("Payment URL = " + objPaymentResponse.payment_options.payment_url); } catch (ArgumentNullException ex) { MessageBox.Show(ex.Message); } catch (WebException ex) { MessageBox.Show(ex.Message); } catch (IOException ex) { MessageBox.Show(ex.Message); } catch (InvalidPaymentOrderException ex) { if (!ex.IsWebhookValid()) { MessageBox.Show("Webhook is invalid"); } if (!ex.IsCurrencyValid()) { MessageBox.Show("Currency is Invalid"); } if (!ex.IsTransactionIDValid()) { MessageBox.Show("Transaction ID is Inavlid"); } } catch (ConnectionException ex) { MessageBox.Show(ex.Message); } catch (BaseException ex) { MessageBox.Show(ex.Message); } catch (Exception ex) { MessageBox.Show("Error:" + ex.Message); } } }