> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://docs.mangopay.com/sdks/nodejs/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.mangopay.com/_mcp/server. # Node.js ## Introduction The Mangopay Node.js SDK makes working with the Mangopay API easier in a Node.js environment. The SDK package is available on npm: [mangopay4-nodejs-sdk](https://www.npmjs.com/package/mangopay4-nodejs-sdk) > **Warning** > > **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). > **Info** > > **Prerequisites** > > To run the Mangopay Node.js SDK, you’ll need: > > * A `ClientId` and an API key – if you don't have these, [contact Sales](https://mangopay.com/contact) to get access to the [Mangopay Dashboard](https://hub.mangopay.com/) > * Node.js installed (v.14 and higher) > * npm package manager installed > **Note** > > **Note - Mangopay SDK compatibility** > > The Node.js SDK is only compatible with the v2.01 version of the Mangopay API. ## Getting started 1. Install the SDK ```javascript npm install mangopay4-nodejs-sdk --save ``` 2. Initialize the SDK ```javascript const mangopay = require('mangopay4-nodejs-sdk'); const paymentApi = new mangopay({ clientId: 'your-mangopay-client-id', clientApiKey: 'your-mangopay-api-key', baseUrl: 'https://api.sandbox.mangopay.com' }); ``` The configuration object of the SDK supports all the following properties:
| Key | Type | Default value | Description |
|---|---|---|---|
| `clientId` | string | `null` | Your Mangopay ClientId – can be found in the [Dashboard](https://hub.mangopay.com/) . |
| `clientApiKey` | string | `null` | Your Mangopay API key – can be found in the [Dashboard](https://hub.mangopay.com/) . |
| `baseUrl` | string | http :// api.sandbox.mangopay.com/ | The API sandbox URL. Set to the sandbox environment by default. To enable production environment, set it to http :// api.mangopay.com/ |
| `debugMode` | boolean | `false` | Activates the debug mode. Recommended only in Sandbox. |
| `logClass` | `function() {console.log(arguments)}` | `function() {console.log(arguments)}` | |
| `connectionTimeout` | integer | `30000` | Set the time to wait (in milliseconds) while trying to establish a connection before terminating the attempt and generating an error. |
| `responseTimeout` | integer | `80000` | Set response timeout limit (in milliseconds). |
| `apiVersion` | string | v2.01 | The API version. |
| `errorHandler` | null | `function(options, err) {console.error(options, err)}` | Set a custom error handler. |