Socket
Socket
Sign inDemoInstall

mercadopago

Package Overview
Dependencies
8
Maintainers
12
Versions
79
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.5.17 to 2.0.0

dist/clients/cardToken/commonTypes.d.ts

58

package.json
{
"name": "mercadopago",
"version": "1.5.17",
"version": "2.0.0",
"description": "Mercadopago SDK for Node.js",
"main": "index.js",
"files": [
"lib/"
],
"main": "dist/index.js",
"types": "dist/index.d.ts",
"scripts": {
"doc": "jsdoc -c jsdoc.json",
"lint": "NODE_ENV=test eslint lib/*.js",
"coverage": "NODE_ENV=test nyc ./node_modules/mocha/bin/_mocha ./test/*.*",
"coveralls": "npm run coverage -- --report lcovonly && cat ./coverage/lcov.info | coveralls",
"test": "NODE_ENV=test mocha ./test/*.*"
"build": "rm -rf dist && tsc --build tsconfig.production.json && tsc-alias -p tsconfig.production.json",
"test": "jest",
"test:e2e": "jest --config e2e/jest.config.ts",
"lint": "eslint 'src/**/*.{ts,tsx}' 'src/examples/**/*.{ts,tsx}' --cache",
"lint:fix": "eslint --fix --ext .ts src src/examples",
"exec": "node_modules/.bin/ts-node -r tsconfig-paths/register",
"prepare": "husky install"
},

@@ -29,3 +29,3 @@ "repository": {

],
"author": "Ariel Rey <ariel.rey@mercadolibre.com>",
"author": "Mercado Pago (https://www.mercadopago.com/developers/en)",
"bugs": {

@@ -36,22 +36,24 @@ "url": "https://github.com/mercadopago/sdk-nodejs/issues"

"devDependencies": {
"chai": "3.5.0",
"chai-as-promised": "6.0.0",
"coveralls": "^3.1.0",
"eslint": ">=4.18.2",
"eslint-config-airbnb-base": "11.0.1",
"eslint-plugin-import": "2.2.0",
"jsdoc": "^4.0.2",
"mocha": "^9.1.3",
"mocha-lcov-reporter": "1.2.0",
"nyc": "^15.1.0",
"sinon": "1.17.7"
"@types/jest": "^29.5.3",
"@types/node": "^20.4.8",
"@types/node-fetch": "^2.6.4",
"@types/uuid": "^9.0.3",
"@typescript-eslint/eslint-plugin": "^6.3.0",
"@typescript-eslint/parser": "^6.3.0",
"eslint": "^8.46.0",
"husky": "^8.0.0",
"jest": "^29.6.2",
"ts-jest": "^29.1.1",
"ts-node": "^10.9.1",
"tsc-alias": "^1.8.7",
"tsconfig-paths": "^4.2.0",
"typescript": "^5.1.6"
},
"files": [
"dist"
],
"dependencies": {
"ajv": "^6.12.3",
"bluebird": "3.4.7",
"dayjs": "^1.11.7",
"request": "^2.88.0",
"request-etag": "2.0.3",
"uuid": "3.0.1"
"node-fetch": "^2.6.12",
"uuid": "^9.0.0"
}
}

@@ -0,1 +1,4 @@

![SDK Node MErcado Pago](https://github.com/lucmkz/sdk-nodejs/assets/31546923/84211022-6fc5-4db1-8772-117eca84f2d9)
# Mercado Pago SDK for NodeJS

@@ -11,3 +14,3 @@

The SDK Supports Node.js v10 or higher.
The SDK Supports NodeJS version 12 or higher.

@@ -23,3 +26,3 @@ ## πŸ“² Installation

2. Copy the access_token in the [credentials](https://www.mercadopago.com/mlb/account/credentials) section of the page and replace YOUR_ACCESS_TOKEN with it.
2. Copy the access_token in the [credentials](https://www.mercadopago.com/developers/en/docs/your-integrations/credentials) section of the page and replace YOUR_ACCESS_TOKEN with it.

@@ -33,21 +36,78 @@ That's it! Mercado Pago SDK has been successfully installed.

```javascript
var mercadopago = require('mercadopago');
mercadopago.configure({
access_token: 'YOUR_ACCESS_TOKEN'
});
// Step 1: Import the parts of the module you want to use
import MercadoPago, { Payment } from 'mercadopago';
var preference = {
items: [
{
title: 'Test',
quantity: 1,
currency_id: 'ARS',
unit_price: 10.5
}
]
// Step 2: Initialize the client object
const client = new MercadoPago({ 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>'
},
};
mercadopago.preferences.create(preference)
// Step 5: Make the request
payment.create({ body }).then(console.log).catch(console.log);
```
### Step 1: Import the parts of the module you want to use
Import `MercadoPago` and API objects from the MercadoPago module.
``` javascript
import MercadoPago, { 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](https://en.wikipedia.org/wiki/Idempotence) Is for retrying requests without accidentally performing the same operation twice
For example:
``` javascript
const client = new MercadoPago({ 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.
``` javascript
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:
``` javascript
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

@@ -58,9 +118,21 @@

- Mercado Pago checkout: [Spanish](https://www.mercadopago.com.ar/developers/es/guides/payments/web-payment-checkout/introduction/) / [Portuguese](https://www.mercadopago.com.br/developers/pt/guides/payments/web-payment-checkout/introduction/)
- Web Tokenize checkout: [Spanish](https://www.mercadopago.com.ar/developers/es/guides/payments/web-tokenize-checkout/introduction/) / [Portuguese](https://www.mercadopago.com.br/developers/pt/guides/payments/web-tokenize-checkout/introduction/)
Check our [official code reference](https://mercadopago.github.io/sdk-nodejs/) 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](CONTRIBUTING.md). 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 [developers.mercadopago.com](https://developers.mercadopago.com)
If you require technical support, please contact our support team at our developers
site: [English](https://www.mercadopago.com/developers/en/support/center/contact)
/ [Portuguese](https://www.mercadopago.com/developers/pt/support/center/contact)
/ [Spanish](https://www.mercadopago.com/developers/es/support/center/contact)

@@ -70,4 +142,4 @@ ## 🏻 License

```
MIT license. Copyright (c) 2021 - Mercado Pago / Mercado Libre
MIT license. Copyright (c) 2023 - Mercado Pago / Mercado Libre
For more information, see the LICENSE file.
```
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚑️ by Socket Inc