Reply
Member
Posts: 1
Registered: ‎03-23-2018

window[s] is not a function Accept.js

[ Edited ]

Hi,

 

I have cordova app which needs to use Authorize.net payment gateway via Accept.js library.

 

window[s] is not a function is the error it is throwing so I am not getting control back in response handler.

 

I am using Hosted form and below is the code 

 

HTML

<form id="paymentForm"
method="POST"
>
<input type="hidden" name="dataValue" id="dataValue" />
<input type="hidden" name="dataDescriptor" id="dataDescriptor" />
<button type="button"
class="AcceptUI"
data-billingAddressOptions='{"show":true, "required":false}'
data-apiLoginID="My Login ID"
data-clientKey="My Client Key"
data-acceptUIFormBtnTxt="Submit"
data-acceptUIFormHeaderTxt="Card Information"
data-responseHandler="responseHandler">Pay
</button>
</form>
 
JAVASCRIPT
 
responseHandler = function(response) {
console.log('response',response);
if (response.messages.resultCode === "Error") {
var i = 0;
while (i < response.messages.message.length) {
console.log(
response.messages.message[i].code + ": " +
response.messages.message[i].text
);
i = i + 1;
}
} else {
this.paymentFormUpdate(response.opaqueData);
}
}

paymentFormUpdate(opaqueData) {
 
(<HTMLInputElement>document.getElementById("dataDescriptor")).value = opaqueData.dataDescriptor;
(<HTMLInputElement>document.getElementById("dataValue")).value = opaqueData.dataValue;

(<HTMLFormElement>document.getElementById("paymentForm")).submit();
}
 
Help me to understand the mistake I am doing.
 
Regards.
Praveen J
Member
Posts: 2
Registered: ‎04-23-2018

Re: window[s] is not a function Accept.js

me too