All Projects → Mangopay → Mangopay2 Nodejs Sdk

Mangopay / Mangopay2 Nodejs Sdk

Licence: mit
Node.js SDK for MANGOPAY

Programming Languages

javascript
184084 projects - #8 most used programming language
js
455 projects

Projects that are alternatives of or similar to Mangopay2 Nodejs Sdk

Mangopay2 Php Sdk
PHP SDK for MANGOPAY
Stars: ✭ 108 (+170%)
Mutual labels:  api, payments, fintech
Coinbase Pro Node
Coinbase Pro API written in TypeScript and covered by tests.
Stars: ✭ 116 (+190%)
Mutual labels:  api, fintech
Openfintech
Opensource FinTech standards & payment provider data
Stars: ✭ 87 (+117.5%)
Mutual labels:  payments, fintech
mangopay2-net-sdk
.Net SDK for MANGOPAY
Stars: ✭ 19 (-52.5%)
Mutual labels:  payments, fintech
Bankscrap
Ruby gem to extract balance and transactions from multiple banks.
Stars: ✭ 197 (+392.5%)
Mutual labels:  api, fintech
Mortgageblockchainfabric
Mortgage Processing App using Hyperledger Fabric Blockchain. Uses channels for privacy and access, and restricts read/write previleges through endorsement policies
Stars: ✭ 45 (+12.5%)
Mutual labels:  payments, fintech
terms-dictionary
Simple definitions of terms, acronyms, abbreviations, companies, and projects related to financial services and Moov.
Stars: ✭ 48 (+20%)
Mutual labels:  payments, fintech
Mojaloop
Starting point for on-boarding and contribution documentation for mojaloop
Stars: ✭ 267 (+567.5%)
Mutual labels:  payments, fintech
mangopay2-java-sdk
Java SDK for MANGOPAY
Stars: ✭ 23 (-42.5%)
Mutual labels:  payments, fintech
mangopay2-python-sdk
SDK Python for MANGOPAY
Stars: ✭ 31 (-22.5%)
Mutual labels:  payments, fintech
bitcoin-ux
💅💸 Ongoing assessment of bitcoin payments and privacy UX for @BitcoinDesign Community as well as tools to help designers understand the underlying protocols and specifications.
Stars: ✭ 39 (-2.5%)
Mutual labels:  payments, fintech
Akaunting
Free and Online Accounting Software
Stars: ✭ 4,599 (+11397.5%)
Mutual labels:  payments, fintech
Example Scalping
A working example algorithm for scalping strategy trading multiple stocks concurrently using python asyncio
Stars: ✭ 267 (+567.5%)
Mutual labels:  api, fintech
Iex Api
The IEX API provides any individual or academic, public or private institution looking to develop applications that require stock market data to access near real-time quote and trade data for all stocks trading on IEX.
Stars: ✭ 683 (+1607.5%)
Mutual labels:  api, fintech
Demo Loopback
Developing a complete REST API with Loopback
Stars: ✭ 37 (-7.5%)
Mutual labels:  api
Gochimp3
🐒 Golang client for MailChimp API 3.0.
Stars: ✭ 39 (-2.5%)
Mutual labels:  api
Stream Deck Api
API to interact with the Elgato Stream Deck controller
Stars: ✭ 36 (-10%)
Mutual labels:  api
Hellobooks
A Single-Page Library Management App built with nodejs, express and react and redux
Stars: ✭ 37 (-7.5%)
Mutual labels:  api
Obs Studio Python Scripting Cheatsheet Obspython Examples Of Api
⚫️ OBS Studio API with Python
Stars: ✭ 40 (+0%)
Mutual labels:  api
Lara Eye
Filter your Query\Builder using a structured query language
Stars: ✭ 39 (-2.5%)
Mutual labels:  api

Mangopay Node.js SDK Build Status

MangopaySDK is a Node.js client library to work with Mangopay REST API.

Installation

Install the module via npm

npm install mangopay2-nodejs-sdk --save

Usage inside your app

var mangopay = require('mangopay2-nodejs-sdk');

var api = new mangopay({
    clientId: 'your_client_id',
    clientApiKey: 'your_client_api_key',
    // Set the right production API url. If testing, omit the property since it defaults to sandbox URL
    baseUrl: 'https://api.mangopay.com'
});

api.Users.create(...)

Supported options

Option Default value Description
clientId null API Client Id
clientApiKey null API Client Api Key
baseUrl "https://api.sandbox.mangopay.com" API Base URL. The default value points to sandbox. Production is 'https://api.mangopay.com'
debugMode false Active debugging
logClass function() {console.log(arguments)} Log function to be used for debug
connectionTimeout 30000 Set the connection timeout limit (in milliseconds)
responseTimeout 80000 Set the response timeout limit (in milliseconds)
apiVersion 'v2.01' API Version
errorHandler function(options, err) {console.error(options, err)} Set a custom error handler

Documentation

Github Full Node.js SDK Documentation is located in /docs folder. You can also access API References on our website.

License

MangopaySDK is distributed under MIT license, see the LICENSE file.

Contacts

Report bugs or suggest features using issue tracker on GitHub.

Account creation

You can get yourself a free sandbox account or sign up for a production account by registering on the Mangopay site (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).

Creating a user

Using a hash of properties:

    mangopay.Users.create({
        "FirstName": "Victor",
        "LastName": "Hugo",
        "Address": "1 rue des Misérables, Paris",
        "Birthday": 1300186358,
        "Nationality": "FR",
        "CountryOfResidence": "FR",
        "Occupation": "Writer",
        "IncomeRange": "6",
        "ProofOfIdentity": null,
        "ProofOfAddress": null,
        "PersonType": "NATURAL",
        "Email": "[email protected]",
        "Tag": "custom tag",
    }, function(model) {
        // User created - using callback
    }).then(function(model){
        // User created - using promise
    });

Using Mangopay SDK pre-defined models:

    var myUser = new api.models.UserLegal({
        Name: 'MangoPay',
        Email: '[email protected]',
        LegalPersonType: 'BUSINESS',
        LegalRepresentativeFirstName: 'Mango',
        LegalRepresentativeLastName: 'Pay',
        LegalRepresentativeEmail: '[email protected]',
        HeadquartersAddress: new api.models.Address({
            AddressLine1: "4101 Reservoir Rd NW",
            AddressLine2: "",
            City: "Washington",
            Region: "District of Columbia",
            PostalCode: "20007",
            Country: "US"
        }),
        LegalRepresentativeBirthday: 1300186358,
        LegalRepresentativeNationality: 'FR',
        LegalRepresentativeCountryOfResidence: 'FR',
        CompanyNumber: 123456789,
        Tag: 'custom tag'
    });

    api.Users.create(myUser).then(function(){
        // Output the created user data to console
        console.log(myUser.Name + ' user created at ' + myUser.CreationDate);
    });

Promise vs Callback

Mangopay Node.js SDK supports both callback and promise approach. Here is how they can be implemented :

    api.Service.method(... , function(data, response, err){
        // Callback method
    })

    api.Service.method(...).then(function(data) {
        // Promise function called
    }, function(error) {
        //exception
    })

Pagination / Filtering

In order to paginate or filter results, we can use options.parameters to specify these options:

    api.Transactions.getAll({
        parameters: {
            // Pagination
            per_page: 2,
            page: 2,

            // Filters
            BeforeDate: 1414000367,
            AfterDate: 1414000367,
            Nature: REGULAR,
            Status: FAILED,
            Type: TRANSFER
        }
    }

Reading server response headers

For reading the server response headers we can use options.resolveWithFullResponse: true

    api.Users.getAll(null, {
      parameters: {
        per_page: 1
      },
      resolveWithFullResponse: true
    }).then(function(response){
      // Read pages count
      console.log(response.headers['x-number-of-pages']);

      // Read response body
      console.log(response.body);
    });

Sample usage of Mangopay SDK installed with npm in a Node.js project

Don't forget to check examples folder !

Contributing

npm start                       // installs dependencies and global mocha for testing and jsdox for documentation
npm test                        // runs the mocha tests
npm run-script documentation    // update documentation using jsdox, make sure to have it installed globally

Unit Tests

Mocha tests are placed under /test/ folder. To run the tests, make sure you have all dependencies installed. Check Contributing section for details.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].