简体   繁体   English

Mercado Pago 客户端 onPaymentMethodsRecieved

[英]Mercado Pago Client onPaymentMethodsRecieved

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)我正在尝试将 Mercado Pago 集成到我的 React 应用程序中,首先我想连接客户端,以便设置一些警报(/process-payments 将通过 python 完成)

I am having a problem.我有问题。 I can not log PaymentMethods nor Issuers.我无法记录 PaymentMethods 或 Issuers。 Strangely my issuers field is populated.奇怪的是,我的 issuers 字段被填充了。 For example whenever I put a random card Number I get logged the installments yet not the issuers (although I can see them)例如,每当我输入一个随机卡号时,我都会记录分期付款而不是发行人(尽管我可以看到它们)

Console and Product image控制台和产品图片

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 'onPaymentMethodsRec ie ved', it should be onPaymentMethodsRec ei ved.我认为你拼错了“onPaymentMethodsRec ie ved”,它应该是onPaymentMethodsRec ie ved。 The same happens in the others logs.其他日志中也会发生同样的情况。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM