how to test mercadopago integration?

375 views Asked by At

I´m trying to test the mercadopago implementation (I guess this post is for devs in Argentina only)

const mercadopago = require("mercadopago");
mercadopago.configure({
  access_token:
    "TEST-Access-Token"
});

var preference = {
    payer_email: "[email protected]",
    back_url: "https://www.test.com/callback",
    reason: "my-reason",
    external_reference: "my-reference",
    auto_recurring: {
      frequency: 1,
      frequency_type: "months",
      transaction_amount: 10000,
      currency_id: "ARS"
    }
};

const preapproval = await mercadopago.preapproval.create(preference);
const location = preapproval && preapproval.response && preapproval.response.init_point;

when I follow the location link I get this error Both payer and collector must be real or test users

I got the payer_email from the generated test user

curl -X POST \
-H "Content-Type: application/json" \
-H 'Authorization: Bearer TEST-Access-Token' \
"https://api.mercadopago.com/users/test_user" \
-d '{"site_id":"MLA"}'
0

There are 0 answers