Skip to content

mercadopago.preferences.get() is not working #65

Closed Answered by gdeandradero
marcuuscardoso asked this question in Q&A
Discussion options

You must be logged in to vote

Hello @Marcus-Cardoso, how are you?
This occurs because not exists a preference with this ID.

To set your access token:

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

To create a preference:

// payload
let preference = {
  items: [
    {
      title: 'My product',
      unit_price: 100,
      quantity: 1
    }
  ]
};

mercadopago.preferences.create(preference).then(function(response){
  console.log(response);
}).catch(function(error){
  console.log(error);
});

To get a preference:

mercadopago.preferences.get(preferenceId).then(response => console.log(response));

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@gdeandradero
Comment options

Answer selected by gdeandradero
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants