.NET Client

Install the .NET server-side SDK to interact with Razorpay APIs to start accepting payments.


The Razorpay Payment Gateway enables you to accept payments via debit card, credit card, netbanking (supports 3D Secure), UPI or through any of our supported wallets. Refer to the Payment Methods section for a list of payment methods we support.

Prerequisites🔗

  • .NET 4.5 with TLS version 1.2

Handy Tips
TLS version 1.2 will work only with .NET version 4.5. Using it with a lower .NET version will lead to errors. Refer to the FAQs section.

.NET Client API🔗

The .NET Client API follows the below practices:

  • Namespaced under Razorpay.Api.
  • The .NET client throws exceptions instead of returning errors.
  • Options are passed as a Dictionary instead of multiple arguments, wherever possible.
  • All requests and responses are communicated over JSON.

Installation🔗

You can install Razorpay using the NuGet Package Manager or using the .NET Core command-line interface (CLI).

NuGet Package Manager🔗

  1. Download the latest source code zip file from the releases section on GitHub.
  2. Download the NuGet Package Manager and install it. Note:
    Nuget Package Manager only supports .NET 4.0 and higher. Make sure that you have the appropriate version of .NET installed.
  • Run the following command on the NuGet Package Manager:

    CopyInstall-Package Razorpay -Version {version_number}

Terminal/Command Prompt🔗

Note:
You must have .NET Core CLI installed on your system to use this method. Download .NET Core CLI.

  1. Download the latest source code file from the nuget.org.

  2. Run the following command:

    Copydotnet add package Razorpay --version {version_number}

Note:
In case the last command fails with "invalid cert received from server", run the following commands:

Copyyes | certmgr -ssl -m https://go.microsoft.com yes | certmgr -ssl -m https://nugetgallery.blob.core.windows.net yes | certmgr -ssl -m https://myget.org yes | certmgr -ssl -m https://nuget.org mozroots --import --sync --quiet

Payment Capture Settings🔗

After payment is authorized, you need to capture it to settle the amount to your bank account as per the settlement schedule. Payments that are not captured are auto-refunded after a fixed time.

  • Auto-capture payments (recommended)
    Authorized payments can be automatically captured. You can auto-capture all payments using global settings on the Razorpay Dashboard. Watch Out!
    Payment capture settings work only if you have integrated with Orders API in your server side. Know more about the Orders API.
  • Manually capture payments
    Each authorized payment can also be captured individually. You can manually capture payments:

Know more about Capture Settings for payments.

Address Verification System🔗

If you are accepting international payments, you can use Razorpay's Address Verification System (AVS). AVS verifies if a customer's billing address (postal code and the billing street address) matches the billing address on file with the card issuer. Based on the response from the issuer, Razorpay will accept or cancel the transaction. This helps in the prevention of fraud in international payments.

Know more about Address Verification System.

×