Skip to content

SDK Instantiation

Ariel Rey edited this page Jan 20, 2017 · 3 revisions

Instantiating the SDK

You don't need to instantiate the SDK, just need to require the package and configure it.

var mercadopago = require('mercadopago');

mercadopago.configure({
  access_token: 'ACCESS_TOKEN'
});

Once you configure the SDK, you don't need to do it again in other modules. This is achieve by the module caching use by Node.js on require.

Backward Compatibility

To support previous integrations with the old SDK (see documentation), you can instantiate the sdk. This is deprecated, do not use it, is going to be remove is future versions.

var mercadopago = require('mercadopago');

var sdk = new mercadopago({
  access_token: 'ACCESS_TOKEN'
});

This is going to internally call the configure method.

Clone this wiki locally