Arts.SslCommerze 1.1.0

dotnet add package Arts.SslCommerze --version 1.1.0                
NuGet\Install-Package Arts.SslCommerze -Version 1.1.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Arts.SslCommerze" Version="1.1.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Arts.SslCommerze --version 1.1.0                
#r "nuget: Arts.SslCommerze, 1.1.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Arts.SslCommerze as a Cake Addin
#addin nuget:?package=Arts.SslCommerze&version=1.1.0

// Install Arts.SslCommerze as a Cake Tool
#tool nuget:?package=Arts.SslCommerze&version=1.1.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

Check from Nuget gallery

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 be true or false. 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 has RedirectGatewayUrl, 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.1.0 952 11/12/2018
1.0.0 1,138 4/7/2018

Major bug fixing