Skip to main content

Introduction

The Mangopay .NET SDK makes working with the Mangopay API easier in a .NET environment. The SDK package is available on NuGet: mangopay4-net-sdk
Caution – Use only the mangopay4 package (late Nov 2025)Please ensure you use only the package with mangopay4 in the name (this is the package name and has no connection with the SDK version number).Any other package must not be used. You need to update your package manually.Since November 25, 2025, Mangopay’s official SDKs are no longer accessible on GitHub (with the exception of PHP for publication reasons).
PrerequisitesTo run the Mangopay .NET SDK, you’ll need:
  • A ClientId and an API key – if you don’t have these, contact Sales to get access to the Mangopay Dashboard
  • .NET Standard 2.0 or .NET 6.0
  • Common.Logging library (version 3.4.1 or higher)
  • Newtonsoft.Json (version 13.0.1 or higher)
  • RestSharp (version 107.3.0 or higher)
  • NETStandard.Library (version 2.0.3 or higher)

Getting started

1. Install the Mangopay package

Installation from the .NET Package Manager Console
Installation with the .NET CLI

2. Initialize and configure the SDK

The configuration object of the SDK supports all the following properties:
KeyTypeDefault valueDescription
ClientIdstringnullYour Mangopay ClientId – can be found in the Dashboard.
ClientPasswordstringnullYour Mangopay API key – can be found in the Dashboard.
BaseUrlstringhttps://api.sandbox.mangopay.com/v2.01/The API sandbox URL. Set to the sandbox environment by default. To enable production environment, set it to https://api.mangopay.com
Timeoutinteger0Time to wait in milliseconds while trying to establish a connection before terminating the attempt and generating an error.
LoggerFactoryAdapterILoggerFactoryAdapterNoOpLoggerFactoryAdapter()Logger adapter implementation. Disabled by default.

SDK usage

In the Mangopay documentation, you’ll find detailed information of all endpoints paired with its corresponding .NET SDK method implementation example. Be sure to customize the provided code to suit your specific requirements.

Idempotency support

To make a request with idempotency support, add idempotencyKey parameter to your function. For more information, see the Idempotency article.
Call - Create user with idempotency key
In order to retrieve the request made using the idempotency key:
Call - View API Response
Output

Pagination

For endpoints that support pagination, you can use the Pagination object.  In the object, you need to specify the page and items per page to return. As a result, the answer will be paginated, and the total number of items and the total number of pages will be provided. For example, with the GET List all Users endpoint :

Rate limiting status

Rate limiting in Mangopay restricts the frequency of API requests a client can make over a defined period, automatically updating the limit with each request and blocking additional requests if the limit is exceeded until it resets. For more information, see the rate limiting article.
Call - View a user
Output

Unit tests

All unit tests are placed under the MangoPay.SDK.Tests directory.

Error handling

The SDK provides the ResponseException class to wrap HTTP errors returned by the API. You can use a standard try-catch block to target the class and add your custom logic, for example: