Skip to content

anilgit90/razorpay-dot-net

This branch is 2 commits ahead of, 14 commits behind razorpay/razorpay-dot-net:master.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

623f1fb · Apr 28, 2024

History

43 Commits
Jan 17, 2023
Feb 29, 2024
Feb 29, 2024
Apr 28, 2024
Apr 28, 2024
Apr 28, 2024
Apr 28, 2024
Nov 9, 2018
Feb 29, 2024
Feb 29, 2024
Feb 29, 2024
Nov 9, 2018
Apr 28, 2024
Jun 2, 2016

Repository files navigation

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 only .Net 4.0 and .net 4.7, Add the required version as reference to your project.

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

  • Open solution in visual studio 2022, it should build fine

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

About

Razorpay .NET SDK

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 100.0%