{"id":18487261,"url":"https://github.com/Mangopay/mangopay2-nodejs-sdk","last_synced_at":"2025-04-08T20:30:51.515Z","repository":{"id":9292341,"uuid":"54960889","full_name":"Mangopay/mangopay2-nodejs-sdk","owner":"Mangopay","description":"Node.js SDK for MANGOPAY","archived":false,"fork":false,"pushed_at":"2024-04-30T13:55:10.000Z","size":1225,"stargazers_count":50,"open_issues_count":31,"forks_count":36,"subscribers_count":14,"default_branch":"master","last_synced_at":"2024-05-02T07:03:56.297Z","etag":null,"topics":["api","fintech","js","mangopay","payments","wallets"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/mangopay2-nodejs-sdk","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Mangopay.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-03-29T08:56:17.000Z","updated_at":"2024-06-18T15:31:08.957Z","dependencies_parsed_at":"2024-02-07T15:29:28.722Z","dependency_job_id":"e9387bf8-a16b-481c-868f-786f4d5bf6c2","html_url":"https://github.com/Mangopay/mangopay2-nodejs-sdk","commit_stats":{"total_commits":461,"total_committers":30,"mean_commits":"15.366666666666667","dds":0.7093275488069415,"last_synced_commit":"4bb7494e99e720aa64c5769a93fb039cbcf83719"},"previous_names":[],"tags_count":83,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mangopay%2Fmangopay2-nodejs-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mangopay%2Fmangopay2-nodejs-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mangopay%2Fmangopay2-nodejs-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mangopay%2Fmangopay2-nodejs-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Mangopay","download_url":"https://codeload.github.com/Mangopay/mangopay2-nodejs-sdk/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247922697,"owners_count":21018845,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","fintech","js","mangopay","payments","wallets"],"created_at":"2024-11-06T12:50:21.774Z","updated_at":"2025-04-08T20:30:50.324Z","avatar_url":"https://github.com/Mangopay.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"Mangopay Node.js SDK [![Build Status](https://travis-ci.org/Mangopay/mangopay2-nodejs-sdk.svg?branch=master)](https://travis-ci.org/Mangopay/mangopay2-nodejs-sdk)\n=================================================\nMangopaySDK is a Node.js client library to work with [Mangopay REST API](http://docs.mangopay.com/api-references/).\n\n\nInstallation\n-------------------------------------------------\nInstall the module via npm\n\n    npm install mangopay2-nodejs-sdk --save\n\nUsage inside your app\n\n    var mangopay = require('mangopay2-nodejs-sdk');\n\n    var api = new mangopay({\n        clientId: 'your_client_id',\n        clientApiKey: 'your_client_api_key',\n        // Set the right production API url. If testing, omit the property since it defaults to sandbox URL\n        baseUrl: 'https://api.mangopay.com'\n    });\n\n    api.Users.create(...)\n\nSupported options\n-------------------------------------------------\n| Option    | Default value | Description |\n| --------  | -----------   | ----------- |\n|clientId   |null      | API Client Id|\n|clientApiKey|null| API Client Api Key|\n|baseUrl|\"https://api.sandbox.mangopay.com\"| API Base URL. The default value points to sandbox. Production is 'https://api.mangopay.com'|\n|debugMode|false| Active debugging|\n|logClass|```function() {console.log(arguments)}```|Log function to be used for debug|\n|connectionTimeout|30000|Set the connection timeout limit (in milliseconds)|\n|responseTimeout|80000|Set the response timeout limit (in milliseconds)|\n|apiVersion|'v2.01'|API Version|\n|errorHandler|```function(options, err) {console.error(options, err)}```|Set a custom error handler\n\nDocumentation\n-------------------------------------------------\n[Github Full Node.js SDK Documentation](docs/README.md) is located in ``/docs`` folder.\nYou can also access [API References on our website](https://docs.mangopay.com/endpoints/).\n\nLicense\n-------------------------------------------------\nMangopaySDK is distributed under MIT license, see the [LICENSE file](LICENSE).\n\nContacts\n-------------------------------------------------\nReport bugs or suggest features using\n[issue tracker on GitHub](https://github.com/Mangopay/mangopay2-nodejs-sdk/issues).\n\nAccount creation\n-------------------------------------------------\nYou can get yourself a free sandbox account or sign up for a production account by [registering on the Mangopay site](https://www.mangopay.com/start/) (note that validation of your production account involves several steps, so think about doing it in advance of when you actually want to go live).\n\n\n### Creating a user\n\n#### Using a hash of properties:\n```ts\n    mangopay.Users.create({\n        \"FirstName\": \"Victor\",\n        \"LastName\": \"Hugo\",\n        \"Address\": \"1 rue des Misérables, Paris\",\n        \"Birthday\": 1300186358,\n        \"Nationality\": \"FR\",\n        \"CountryOfResidence\": \"FR\",\n        \"Occupation\": \"Writer\",\n        \"IncomeRange\": \"6\",\n        \"ProofOfIdentity\": null,\n        \"ProofOfAddress\": null,\n        \"PersonType\": \"NATURAL\",\n        \"Email\": \"victor@hugo.com\",\n        \"Tag\": \"custom tag\",\n    }, function(model) {\n        // User created - using callback\n    }).then(function(model){\n        // User created - using promise\n    });\n```\n\n#### Using Mangopay SDK pre-defined models:\n```ts\n    var myUser = new api.models.UserLegal({\n        Name: 'MangoPay',\n        Email: 'info@mangopay.com',\n        LegalPersonType: 'BUSINESS',\n        LegalRepresentativeFirstName: 'Mango',\n        LegalRepresentativeLastName: 'Pay',\n        LegalRepresentativeEmail: 'mango@mangopay.com',\n        HeadquartersAddress: new api.models.Address({\n            AddressLine1: \"4101 Reservoir Rd NW\",\n            AddressLine2: \"\",\n            City: \"Washington\",\n            Region: \"District of Columbia\",\n            PostalCode: \"20007\",\n            Country: \"US\"\n        }),\n        LegalRepresentativeBirthday: 1300186358,\n        LegalRepresentativeNationality: 'FR',\n        LegalRepresentativeCountryOfResidence: 'FR',\n        CompanyNumber: 123456789,\n        Tag: 'custom tag'\n    });\n\n    api.Users.create(myUser).then(function(){\n        // Output the created user data to console\n        console.log(myUser.Name + ' user created at ' + myUser.CreationDate);\n    });\n```\n\n#### Promise vs Callback\nMangopay Node.js SDK supports both callback and promise approach.\nHere is how they can be implemented :\n\n```ts\n    api.Service.method(... , function(data, response, err){\n        // Callback method\n    })\n\n    api.Service.method(...).then(function(data) {\n        // Promise function called\n    }, function(error) {\n        //exception\n    })\n```\n\n### Pagination / Filtering\nIn order to [paginate or filter](https://docs.mangopay.com/guide/lists-pagination-management) results,\nwe can use ``options.parameters`` to specify these options:\n```ts\n    api.Transactions.getAll({\n        parameters: {\n            // Pagination\n            per_page: 2,\n            page: 2,\n\n            // Filters\n            BeforeDate: 1414000367,\n            AfterDate: 1414000367,\n            Nature: REGULAR,\n            Status: FAILED,\n            Type: TRANSFER\n        }\n    }\n```\n\n### Reading server response headers\nFor [reading the server response headers](examples/readResponseHeaders.js) we can use ``options.resolveWithFullResponse: true``\n```ts\n    api.Users.getAll(null, {\n      parameters: {\n        per_page: 1\n      },\n      resolveWithFullResponse: true\n    }).then(function(response){\n      // Read pages count\n      console.log(response.headers['x-number-of-pages']);\n\n      // Read response body\n      console.log(response.body);\n    });\n```\n\nSample usage of Mangopay SDK installed with npm in a Node.js project\n-------------------------------------------------\nDon't forget to check examples folder !\n\nContributing\n-------------------------------------------------\n    npm start                       // installs dependencies and global mocha for testing and jsdox for documentation\n    npm test                        // runs the mocha tests\n    npm run-script documentation    // update documentation using jsdox, make sure to have it installed globally\n\nUnit Tests\n-------------------------------------------------\nMocha tests are placed under ``/test/`` folder. To run the tests, make sure you have all dependencies installed.\nCheck Contributing section for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FMangopay%2Fmangopay2-nodejs-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FMangopay%2Fmangopay2-nodejs-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FMangopay%2Fmangopay2-nodejs-sdk/lists"}