Skip to content

Commit

Permalink
Updated to V4 API
Browse files Browse the repository at this point in the history
  • Loading branch information
prabalsslw committed Jun 27, 2020
1 parent 92083e9 commit a9b59a6
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 6 deletions.
7 changes: 6 additions & 1 deletion App_Code/SSLCommerz.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down Expand Up @@ -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; }
}
}
11 changes: 8 additions & 3 deletions Default.aspx.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ 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
PostData.Add("cancel_url", baseUrl+"Cancel.aspx"); // "Cancel.aspx" page needs to be created
PostData.Add("version", "3.00");
PostData.Add("cus_name", "ABC XY");
PostData.Add("cus_email", "[email protected]");
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");
Expand All @@ -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);
}
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
4 changes: 2 additions & 2 deletions Success.aspx.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit a9b59a6

Please sign in to comment.