Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alguem ja integrou pagamento recorrente do mercado pago com Vue ? #68

Open
webesistemas opened this issue Apr 4, 2022 · 1 comment
Open

Comments

@webesistemas
Copy link

Estou tentando gerar o token do cartao de crédito
mas ao enviá-lo para o back nao esta sendo aceito
e a api retorna o erro Card Number can't be empty, please generate a valid card token

@webesistemas
Copy link
Author

webesistemas commented Apr 4, 2022

const mp = new MercadoPago('APP_USR-90e0a51f-5050-4e31-bba1-xxxxxxxxxxx');
/* eslint-disable */
const createCardTokenMP = async (th) => {
  if (th.cartao === null || th.nome === null || th.expirationMonth === null
    || th.cardExpirationYear === null) { return false; }
  try {
    const token = await mp.createCardToken({
      cardNumber: th.cartao,
      cardholderName: th.nome,
      identificationType: 'CPF',
      identificationNumber: th.cpf,
      securityCode: th.cvv,
      cardExpirationMonth: th.expirationMonth,
      cardExpirationYear: th.expirationYear,
    });
    // eslint-disable-next-line
    console.log('card token: ', token);
    return token.id;
  } catch (e) {
    // eslint-disable-next-line
    console.error('error creating card token: ', e);
    return false;
  }
};

mas esse token nao esta sendo validado no back

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant