Razorpay 3.3.2

dotnet add package Razorpay --version 3.3.2
                    
NuGet\Install-Package Razorpay -Version 3.3.2
                    
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="Razorpay" Version="3.3.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Razorpay" Version="3.3.2" />
                    
Directory.Packages.props
<PackageReference Include="Razorpay" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Razorpay --version 3.3.2
                    
#r "nuget: Razorpay, 3.3.2"
                    
#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.
#:package Razorpay@3.3.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Razorpay&version=3.3.2
                    
Install as a Cake Addin
#tool nuget:?package=Razorpay&version=3.3.2
                    
Install as a Cake Tool

Razorpay .NET SDK

Razorpay client .NET Api. The api follows the following practices

  • Namespaced under Razorpay.Api .
  • Client throws exceptions instead of returning errors.
  • Options are passed as Dictionary instead of multiple arguments wherever possible.
  • All requests and responses are communicated over JSON.
  • A minimum of .Net 4.0 is required.

Installation

Using the NuGet Command Line Interface (CLI)

nuget install Razorpay

else

  • Download Nuget package from here
  • Package supports .NET Framework 4.7+, .NET Standard 2.0, .NET 6.0+
  • For .NET Framework 4.0/4.5: Manual compilation required (see Legacy Framework Support section below)

Usage

RazorpayClient can be instantiated via two ways:

Using Private Auth

Instantiate RazorpayClient with key_id & key_secret. You can obtain the keys from the dashboard app https://dashboard.razorpay.com/#/app/keys

RazorpayClient client = new RazorpayClient(key, secret); 
Add custom headers to request (optional)
client.addHeader(string,string);

Using Access Token

Instantiate RazorpayClient with access_token. The access_token can be obtained only in case if you are a platform partner. For more information, refer page - https://razorpay.com/docs/partners/platform/.

RazorpayClient client = new RazorpayClient(access_token); 
Add custom headers to request (optional)
client.addHeader(string,string);

Supported Resources


Development

Quick Start

The project now uses a unified multi-targeting approach. Simply:

# Restore dependencies
dotnet restore

# Build all target frameworks
dotnet build --configuration Release

# Create NuGet package
dotnet pack --configuration Release

Target Frameworks Supported

  • .NET Framework 4.7, 4.8
  • .NET Standard 2.0 ⭐ (New - maximum compatibility)
  • .NET 6.0, 8.0

📢 Important Note: We do not provide pre-built DLLs for .NET Framework 4.0 and 4.5 in our NuGet package. These frameworks are legacy (2010-2012) and most applications have migrated to newer versions. However, you can still use Razorpay with these frameworks by compiling the source code manually.

Legacy Framework Support (.NET 4.0, 4.5)

Not included in NuGet package - For .NET Framework 4.0 and 4.5 support, you can manually compile the source code:

Manual Compilation for .NET 4.0/4.5
# 1. Install required NuGet packages
nuget install Newtonsoft.Json -Version 13.0.3 -OutputDirectory packages
nuget install Portable.BouncyCastle -Version 1.9.0 -OutputDirectory packages

# 2. Compile for .NET 4.0
csc /target:library /out:Razorpay-net40.dll /reference:packages/Newtonsoft.Json.13.0.3/lib/net40/Newtonsoft.Json.dll /reference:packages/Portable.BouncyCastle.1.9.0/lib/net40/BouncyCastle.Crypto.dll /reference:System.dll /reference:System.Core.dll /reference:System.Net.dll /reference:System.Net.Http.dll /reference:Microsoft.CSharp.dll src/**/*.cs

# 3. Compile for .NET 4.5  
csc /target:library /out:Razorpay-net45.dll /reference:packages/Newtonsoft.Json.13.0.3/lib/net45/Newtonsoft.Json.dll /reference:packages/Portable.BouncyCastle.1.9.0/lib/net40/BouncyCastle.Crypto.dll /reference:System.dll /reference:System.Core.dll /reference:System.Net.dll /reference:System.Net.Http.dll /reference:Microsoft.CSharp.dll src/**/*.cs

Note: .NET Standard 2.0 provides better compatibility and is recommended over .NET Framework 4.0/4.5.

IDE Support

  • Visual Studio 2022: Open Razorpay.sln - it will build all target frameworks
  • VS Code: Use the integrated terminal with the dotnet CLI commands above
  • JetBrains Rider: Full multi-targeting support

CI/CD

The project includes GitHub Actions workflow that:

  • Builds all target frameworks on both Linux and Windows
  • Runs tests (if available)
  • Creates NuGet packages
  • Publishes to NuGet on master branch (if configured)

Ubuntu

Compiling using Mono

  • Download the 'Newtonsoft.Json' nuget package.
nuget install Newtonsoft.Json -Version 13.0.3 -OutputDirectory packages
  • Download the 'Portable.BouncyCastle' nuget package.
nuget install Portable.BouncyCastle -Version 1.9.0 -OutputDirectory packages
  • Download the 'NUnit' nuget package.
nuget install NUnit -Version 3.6.1 -OutputDirectory packages
  • Create a bin folder in the root directory
mkdir bin
  • Compile the source code into a library
mcs -t:library -lib:"/usr/lib/mono/4.5" -r:"System.dll,System.Net.dll,System.Net.Http.dll,System.Core.dll,System.Xml.dll,System.Xml.Linq.dll,System.Core.dll,./packages/Newtonsoft.Json.13.0.3/lib/net45/Newtonsoft.Json.dll,./packages/Portable.BouncyCastle.1.9.0/lib/net40/BouncyCastle.Crypto.dll" -out:"bin/RazorpayClient.dll" ./src/**/*.cs -lib:/usr/lib/mono/2.0
  • copy Dependency dll
cp packages/Newtonsoft.Json.13.0.3/lib/net45/Newtonsoft.Json.dll ./bin
cp packages/Portable.BouncyCastle.1.9.0/lib/net40/BouncyCastle.Crypto.dll ./bin
cp packages/NUnit.3.6.1/lib/net45/nunit.framework.dll ./bin
  • Compile test exe
mcs -t:exe -lib:"/usr/lib/mono/4.5,./bin" -r:"RazorpayClient.dll,Newtonsoft.Json.dll,BouncyCastle.Crypto.dll,nunit.framework.dll" -out:"bin/RazorpayApiTest.exe" ./test/*.cs
  • Run Test exe
mono bin/RazorpayApiTest.exe [key] [secret]

Compiling using xbuild

Run xbuild (in the root directory where sln file exist)

FAQ

  1. In case the last command fails with "invalid cert received from server", run below commands
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 is compatible.  net471 was computed.  net472 was computed.  net48 is compatible.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (3)

Showing the top 3 NuGet packages that depend on Razorpay:

Package Downloads
SnkNetServer

Package Description

SnkRazorPayHelper

SnkRazorPayHelper

Nagp.Ecom.Services.Common.Payment

This package provides an interface to payment gateway.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
3.3.2 339 9/4/2025
3.3.1 209 9/2/2025
3.3.0 135 9/2/2025
3.2.0 1,565 8/9/2025
3.1.4 28,765 12/27/2024
3.1.3 34,083 6/24/2024
3.1.2 9,492 5/13/2024
3.1.1 6,943 2/29/2024
3.1.0 14,944 10/31/2023
3.0.2 31,398 10/19/2022
3.0.0 141,568 11/12/2018
2.2.0 21,855 1/9/2018
2.1.0 3,299 9/27/2017
2.0.0 11,696 7/6/2017
1.1.1 3,052 11/19/2016
1.1.0 3,237 6/2/2016
1.0.0 3,436 12/19/2015

Added .NET Standard 2.0 support for maximum compatibility across .NET ecosystem. Supports .NET Framework 4.7+, .NET Core 2.0+, .NET 5+, and modern .NET 6.0+