Arts.SslCommerze
1.0.0
See the version list below for details.
dotnet add package Arts.SslCommerze --version 1.0.0
NuGet\Install-Package Arts.SslCommerze -Version 1.0.0
<PackageReference Include="Arts.SslCommerze" Version="1.0.0" />
paket add Arts.SslCommerze --version 1.0.0
#r "nuget: Arts.SslCommerze, 1.0.0"
// Install Arts.SslCommerze as a Cake Addin #addin nuget:?package=Arts.SslCommerze&version=1.0.0 // Install Arts.SslCommerze as a Cake Tool #tool nuget:?package=Arts.SslCommerze&version=1.0.0
Arts.SslCommerze
SSLCOMMERZ is the first payment gateway in Bangladesh opening doors for merchants to receive payments on the internet via their online stores. Customers are able to buy products online using their credit cards as well as bank accounts.
Dependencies
- .NETFramework, Version >= v4.5
- Microsoft.AspNet.Mvc, Version >= 5.0.0
Features
- Creating session for initiate a trasaction
- Validation of a transaction
- Refund a transaction
- Refund query
- Transaction query by both SessionId and TransactionId
Install via nuget
PM > Install-Package Arts.SslCommerze
Configuration
Add a
sslcommerz.config
file in your project directory. The content will have your store information like StoreId, StorePass. IsSandBox will betrue
orfalse
. If it is true, then all the requests will be sent to the sslCommerze sandbox url, else all will be sent to the real transaction url.<?xml version="1.0" encoding="UTF-8" ?> <ArtsSslCommerz> <IsSandBox>true</IsSandBox> <Credential> <Sandbox storeid="SandboxStoreId" pass="SandboxStorePass"/> <Live storeid="RealStoreId" pass="RealStorePass" /> </Credential> </ArtsSslCommerz>
Use this namespace
ARTS.SslCommerze
Place this following code snippet at you application initalization function.
Configuration.Configure();
For MVC application place in
Application_Start()
.
How to use
Initiat a session for trransaction:
string customerName = "Customer name"; string customerEmail = "Customer email"; string customerPhone = "Customer phone"; string transactionId = "transactionId"; string successUrl = "successUrl"; string failUrl = "failUrl"; string cancelUrl = "cancelUrl"; decimal amount = 50; Customer customer = new Customer(customerName, customerEmail, customerPhone); EmiTransaction emiTransaction = new EmiTransaction(); Trasnaction trasnaction = new Trasnaction(amount, transactionId, successUrl, failUrl, cancelUrl, emiTransaction, customer); TransactionSession session = SslRequest.GetSessionAsync(trasnaction).Result;
The response
TransactionSession
hasRedirectGatewayUrl
,DirectPaymentUrl
,GatewayPageUrl
. Use necessary url for customer to be redirected to pay.Verifying a transaction response: Getting a response in your IPN action and process the response like below.
public void SslTransactionResponse(FormCollection fromCollection) { TransactionResponse response = SslRequest.GetTransactionResponse(fromCollection); if (response.Status == TransactionStatus.VALID) { ValidatedTransaction validatedTransaction = SslRequest.ValidateTransaction(fromCollection); if (validatedTransaction.Status != ValidationStatus.INVALID_TRANSACTION) { // Update database as your need } } }
Refund:
decimal refundAnount = 100; RefundResponse res = SslRequest.RefundAsync("bankTrasactionId", refundAnount, "remark", "refId").Result;
Query:
Refund Query
RefundQueryResponse res = SslQuery.RefundQueryAsync("RefundRefId").Result;
Trasaction query by session id
TransactionQueryBySessionResponse res = SslQuery.TransactionQueryBySessionIdAsync("SessionId").Result;
Trasaction query by trasaction id
TransactionQueryByTransIdResponse res = SslQuery.TransactionQueryByTransIdAsync("RefundRefId").Result;
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET Framework | net45 is compatible. net451 was computed. net452 was computed. net46 was computed. net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
-
- Microsoft.AspNet.Mvc (>= 5.0.0)
- Newtonsoft.Json (>= 10.0.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
First Release