I am trying to integrate Mercado Pago to my React aplication, first I want to connect the client so I can set up some alerts (/process-payments is going to be done through python)
I am having a problem. I can not log PaymentMethods nor Issuers. Strangely my issuers field is populated. For example whenever I put a random card Number I get logged the installments yet not the issuers (although I can see them)
The following is my code:
useEffect(() => {
if (MercadoPago) {
const mp = new MercadoPago(
PUBLIC_KEY
);
console.log("mp es", mp);
const cardForm = mp.cardForm({
amount: "200",
autoMount: true,
form: formConfig,
callbacks: {
onFormMounted: (error) => {
if (error) {
return console.warn("Form mounted handling error: ", error);
}
console.log("Form Mounted");
},
onPaymentMethodsRecieved: (error, paymentMethods) => {
console.log("In Payment methods");
if (error) {
window.alert("No payment methods");
}
console.log("Payment Methods Available", paymentMethods);
},
onIssuersRecieved: (error, issuers) => {
if (error) return console.warn("issuers handling error: ", error);
console.log("Issuers available: ", issuers);
},
onInstallmentsReceived: (error, installments) => {
if (error)
return console.warn("installments handling error: ", error);
console.log("Installments available: ", installments);
},
onCardTokenRecieved: (error, token) => {
if (error) {
return console.warn("Token no se pudo crear: ", error);
}
console.log("Token available: ", token);
},.......}
I think you misspelled 'onPaymentMethodsRecieved', it should be onPaymentMethodsReceived. The same happens in the others logs.