2.0.8 β€’ Published 1 month ago

mercadopago v2.0.8

Weekly downloads
5,855
License
-
Repository
github
Last release
1 month ago

SDK Node Mercado Pago

Mercado Pago SDK for NodeJS

NPM Version Downloads License

This library provides developers with a simple set of bindings to help you integrate Mercado Pago API to a website and start receiving payments.

πŸ’‘ Requirements

The SDK Supports NodeJS version 12 or higher.

πŸ“² Installation

First time using Mercado Pago? Create your Mercado Pago account, if you don’t have one already.

  1. Install NodeJS SDK for MercadoPago running in command line:
$ npm install --save mercadopago
  1. Copy the access_token in the credentials section of the page and replace YOUR_ACCESS_TOKEN with it.

That's it! Mercado Pago SDK has been successfully installed.

🌟 Getting Started

Simple usage looks like:

// Step 1: Import the parts of the module you want to use
import { MercadoPagoConfig, Payment } from 'mercadopago';

// Step 2: Initialize the client object
const client = new MercadoPagoConfig({ accessToken: 'access_token', options: { timeout: 5000, idempotencyKey: 'abc' } });

// Step 3: Initialize the API object
const payment = new Payment(client);

// Step 4: Create the request object
const body = {
	transaction_amount: 12.34,
	description: '<DESCRIPTION>',
	payment_method_id: '<PAYMENT_METHOD_ID>',
	payer: {
		email: '<EMAIL>'
	},
};

// Step 5: Create request options object - Optional
const requestOptions = {
	idempotencyKey: '<IDEMPOTENCY_KEY>',
};

// Step 6: Make the request
payment.create({ body, requestOptions }).then(console.log).catch(console.log);

Step 1: Import the parts of the module you want to use

Import MercadoPagoConfig and API objects from the MercadoPago module.

import { MercadoPagoConfig, Payment } from 'mercadopago';

Step 2: Initialize the client object

Initialize the client object, passing the following:

  • accessToken: Application's private key.
  • options: These are optional fields,
    • timeout: Are the timeout of requests
    • idempotencyKey: Idempotency Is for retrying requests without accidentally performing the same operation twice

For example:

const client = new MercadoPagoConfig({ accessToken: 'access_token', options: { timeout: 5000, idempotencyKey: 'abc' } });

Step 3: Initialize the API object

Initialize the API object you want to use, passing the client object from the previous step.

const payment = new Payment(client);

Step 4: Create the request object

Create a the request object. For example, for a request to the /v1/payments endpoint:

const body = {
	transaction_amount: 12.34,
	description: '<DESCRIPTION>',
	payment_method_id: '<PAYMENT_METHOD_ID>',
	payer: {
		email: '<EMAIL>'
	},
};

Step 5: Make the request

Use the API object's method to make the request. For example, to make a request to the /v1/payments endpoint using the payment object:

payment.create({ body }).then(console.log).catch(console.log);

πŸ“š Documentation

Visit our Dev Site for further information regarding:

Check our official code reference to explore all available functionalities.

🀝 Contributing

All contributions are welcome, ranging from people wanting to triage issues, others wanting to write documentation, to people wanting to contribute with code.

Please read and follow our contribution guidelines. Contributions not following these guidelines will be disregarded. The guidelines are in place to make all of our lives easier and make contribution a consistent process for everyone.

Patches to version 1.x.x

Since the release of version 2.0.0, version 1 is deprecated and will not be receiving new features, only bug fixes. If you need to submit PRs for that version, please do so by using develop-v1 as your base branch.

❀️ Support

If you require technical support, please contact our support team at our developers site: English / Portuguese / Spanish

🏻 License

MIT license. Copyright (c) 2023 - Mercado Pago / Mercado Libre 
For more information, see the LICENSE file.
2.0.8

1 month ago

2.0.7

2 months ago

2.0.6

3 months ago

2.0.5

4 months ago

2.0.3

5 months ago

2.0.2

5 months ago

2.0.4

5 months ago

2.0.1

6 months ago

2.0.0

6 months ago

1.5.17

8 months ago

1.5.16

11 months ago

1.5.15

1 year ago

1.5.14

2 years ago

1.5.13

2 years ago

1.5.10

2 years ago

1.5.12

2 years ago

1.5.11

2 years ago

1.5.9

2 years ago

1.5.8

3 years ago

1.5.7

3 years ago

1.5.6

3 years ago

1.5.5

3 years ago

1.5.4

3 years ago

1.5.3

3 years ago

1.5.2

3 years ago

1.5.1

3 years ago

1.5.0

3 years ago

1.3.2

4 years ago

1.3.1

4 years ago

1.3.0

4 years ago

1.2.1

4 years ago

1.2.0

5 years ago

1.1.0

5 years ago

1.0.24

5 years ago

1.0.23

5 years ago

1.0.22

5 years ago

1.0.21

5 years ago

1.0.20

5 years ago

1.0.19

6 years ago

1.0.18

6 years ago

1.0.17

6 years ago

1.0.16

6 years ago

1.0.15

6 years ago

1.0.14

6 years ago

1.0.13

6 years ago

1.0.12

6 years ago

1.0.11

6 years ago

1.0.10

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago

0.5.0

8 years ago

0.3.3

9 years ago

0.3.2

9 years ago

0.3.1

9 years ago

0.3.0

9 years ago

0.2.2

9 years ago

0.2.1

11 years ago

0.2.0

11 years ago

0.1.8

11 years ago

0.1.5

11 years ago

0.0.11

11 years ago

0.0.10-beta

11 years ago

0.0.10

11 years ago

0.0.9

11 years ago

0.0.8

11 years ago

0.0.6

11 years ago

0.0.5

11 years ago

0.0.4

11 years ago

0.0.3

11 years ago

0.0.2

11 years ago