x

SqPaymentForm not working on dynamic form

As you know the SqPaymentForm is the only way of getting a nonce, so if it doesn't work, ou're stuck. As you guess, it doesn't work for me because I'm writing dynamically the form. In pseudo code to summarize the issue

 

 
var form = <form id="nonce-form" novalidate action="process-card.php" method="post">'+
             'Pay with a Credit Card'+
              '<table>'+ ....(the whole structure from the form example) .. +'<form>'
 document.getElementById("sq-ccbox").innerHTML = form;
 window.setTimeout(function () {
      var paymentForm = new SqPaymentForm(initObj); 
    }.bind(this), 2000);

 

Ok, now for those wondering, I have included both paymentform, sqpaymentform.js and sqpaymentform.css file (I can't post here because it cleans for security reasons)

 

I change sqpaymentform.js to not instantiate the class but just init the object, so I can create after 2 seconds and nothing, not form at all. I guess is related to the dynamic creation ... but I need it ... any workaround?

 

If you want to see in action, https://dev.3818.com.ar/redi/index2.html

If you want to run locally https://dev.3818.com.ar/redi/square.rar

 

Thanks for any input !

907 Views
Message 1 of 1
Report
0 REPLIES 0