Skip to content

mercadopago.preferences.create() #189

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

You must be logged in to vote

Hi how are you?
It is likely that you have installed version 2 of the SDK and are implementing version 1.
The recommended option is to implement version 2, in your example there would be the following changes:

from

const mercadopago = require(“mercadopago”);

new mercadopago.MercadoPagoConfig({
access_token:
“”,
});

to

import { MercadoPagoConfig, Preference } from ‘MercadoPago’;

const client = new MercadoPagoConfig({ accessToken: ‘YOUR_AT’ });

and

let preference = {
        items: [
            {
                title: req.body.description,
                unit_price: Number(req.body.price),
                quantity: Number(req.body.quantity),
            },
        ],
        back_urls: {

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
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