From a9b59a630d911fac415abb925a5d9a8424569daa Mon Sep 17 00:00:00 2001 From: Prabal Mallick Date: Sat, 27 Jun 2020 11:52:43 +0600 Subject: [PATCH] Updated to V4 API --- App_Code/SSLCommerz.cs | 7 ++++++- Default.aspx.cs | 11 ++++++++--- README.md | 1 + Success.aspx.cs | 4 ++-- 4 files changed, 17 insertions(+), 6 deletions(-) diff --git a/App_Code/SSLCommerz.cs b/App_Code/SSLCommerz.cs index 9b3dde9..43b86a3 100644 --- a/App_Code/SSLCommerz.cs +++ b/App_Code/SSLCommerz.cs @@ -24,7 +24,7 @@ public class SSLCommerz protected bool Store_Test_Mode; protected string SSLCz_URL = "https://securepay.sslcommerz.com/"; - protected string Submit_URL = "gwprocess/v3/api.php"; + protected string Submit_URL = "gwprocess/v4/api.php"; protected string Validation_URL = "validator/api/validationserverAPI.php"; protected string Checking_URL = "validator/api/merchantTransIDvalidationAPI.php"; @@ -317,5 +317,10 @@ public class SSLCommerzValidatorResponse public string validated_on { get; set; } public string gw_version { get; set; } public string token_key { get; set; } + public string shipping_method { get; set; } + public string num_of_item { get; set; } + public string product_name { get; set; } + public string product_profile { get; set; } + public string product_category { get; set; } } } diff --git a/Default.aspx.cs b/Default.aspx.cs index ea4bc59..abd29d4 100644 --- a/Default.aspx.cs +++ b/Default.aspx.cs @@ -14,7 +14,7 @@ protected void Page_Load(object sender, EventArgs e) // CREATING LIST OF POST DATA NameValueCollection PostData = new NameValueCollection(); - PostData.Add("total_amount", "1150.00"); + PostData.Add("total_amount", "15.00"); PostData.Add("tran_id", "TESTASPNET1234"); PostData.Add("success_url",baseUrl+"Success.aspx"); PostData.Add("fail_url", baseUrl+"Fail.aspx"); // "Fail.aspx" page needs to be created @@ -22,7 +22,7 @@ protected void Page_Load(object sender, EventArgs e) PostData.Add("version", "3.00"); PostData.Add("cus_name", "ABC XY"); PostData.Add("cus_email", "abc.xyz@mail.co"); - PostData.Add( "cus_add1", "Address Line On"); + PostData.Add("cus_add1", "Address Line On"); PostData.Add("cus_add2", "Address Line Tw"); PostData.Add("cus_city", "City Nam"); PostData.Add("cus_state", "State Nam"); @@ -41,8 +41,13 @@ protected void Page_Load(object sender, EventArgs e) PostData.Add("value_b", "ref00"); PostData.Add("value_c", "ref00"); PostData.Add("value_d", "ref00"); + PostData.Add("shipping_method", "NO"); + PostData.Add("num_of_item", "1"); + PostData.Add("product_name", "Demo"); + PostData.Add("product_profile", "general"); + PostData.Add("product_category", "Demo"); - SSLCommerz sslcz = new SSLCommerz("YOUR STORE ID", "YOUR STORE PASSWORD"); + SSLCommerz sslcz = new SSLCommerz("testbox", "qwerty", true); String response = sslcz.InitiateTransaction(PostData); Response.Redirect(response); } diff --git a/README.md b/README.md index deaf493..545237b 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,7 @@ 1. Visual Studio 2017 2. [Sandbox Account](https://developer.sslcommerz.com/registration/ "SSLCommerz Sandbox Registration") +3. TLS V1.2 ## Process flow to integrate SSLCommerz by using ASP.Net sample code. diff --git a/Success.aspx.cs b/Success.aspx.cs index 4af8072..d805ac8 100644 --- a/Success.aspx.cs +++ b/Success.aspx.cs @@ -13,11 +13,11 @@ protected void Page_Load(object sender, EventArgs e) { string TrxID = Request.Form["tran_id"]; // AMOUNT and Currency FROM DB FOR THIS TRANSACTION - string amount = "1150"; + string amount = "15"; string currency = "BDT"; SSLCommerz sslcz = new SSLCommerz("testbox", "qwerty", true); - Response.Write(sslcz.OrderValidate(TrxID, amount, currency, Request)); + Response.Write("Validation Response: "+sslcz.OrderValidate(TrxID, amount, currency, Request)); } else { Response.Write("not found");