0

Estoy tratando de realizar un pago con TDC, utilizando el siguiente código:

var MP = require("mercadopago");

//Este ACCESS_TOKEN lo obtuve con mercado pago connect
var mp = new MP("ACCESS_TOKEN"); 

var payer = {
        "first_name": "APRO PEDRO",
        "last_name": "PEREZ",
        "email": "[email protected]",
        "identification": {
            "type": "CI-V",
            "number": "12345678"
        }
    };


var pay = {
  "transaction_amount": 5250.35,
  "token": "03eb840972fb016800a7a316b46ae9c9",
  "description": "Compra de un cafe",
  "installments": 1,
  "payer": payer,
  "payment_method_id": "master",
  "application_fee": 1.97
}

var doPayment = mp.post("/v1/payments", pay);

doPayment.then(function(payment) {
  console.log(payment);
}, function(error) {
  console.log(error);
});

La respuesta que obtengo es la siguiente:

{ Error
    at new MercadoPagoError (/proyect/node_modules/mercadopago/lib/mercadopago.js:16:16)
    at Request._callback (/proyect/node_modules/mercadopago/lib/mercadopago.js:527:22)
    at Request.self.callback (/proyect/node_modules/request/request.js:188:22)
    at emitTwo (events.js:106:13)
    at Request.emit (events.js:191:7)
    at Request.<anonymous> (/proyect/node_modules/request/request.js:1171:10)
    at emitOne (events.js:96:13)
    at Request.emit (events.js:188:7)
    at IncomingMessage.<anonymous> (/proyect/node_modules/request/request.js:1091:12)
    at IncomingMessage.g (events.js:292:16)
  name: 'MercadoPagoError',
  message: 'Invalid credentials',
  stack: 'Error\n    at new MercadoPagoError (/proyect/node_modules/mercadopago/lib/mercadopago.js:16:16)\n    at Request._callback (/proyect/node_modules/mercadopago/lib/mercadopago.js:527:22)\n    at Request.self.callback (/proyect/node_modules/request/request.js:188:22)\n    at emitTwo (events.js:106:13)\n    at Request.emit (events.js:191:7)\n    at Request.<anonymous> (/proyect/node_modules/request/request.js:1171:10)\n    at emitOne (events.js:96:13)\n    at Request.emit (events.js:188:7)\n    at IncomingMessage.<anonymous> (/proyect/node_modules/request/request.js:1091:12)\n    at IncomingMessage.g (events.js:292:16)',
  status: 400 }
2
  • Error de autenticación, o sea, q el user, pass o token, están mal
    – FederHico
    Commented el 22 may. 2017 a las 20:14
  • ATENCION: es 'Token' , no 'Tocken'
    – FederHico
    Commented el 22 may. 2017 a las 20:15

0

Tu Respuesta

By clicking “Publica tu respuesta”, you agree to our terms of service and acknowledge you have read our privacy policy.

Examina otras preguntas con la etiqueta o formula tu propia pregunta.