cancel
Showing results for 
Search instead for 
Did you mean: 

Who Me Too'd this topic

Accept.js encryption failed

Hi,

 

I am using Accept.js in a single page React application. I have my own AddPaymentProfileForm component so I'm building the form myself and sending the CC info to Accept.js for a token in return. I'm receiving the following error:

E_WC_14: Accept.js encryption failed.

I have analyzed the network requests and both the OPTIONS request and the POST request are receving successful 200 responses. The POST response contains:

code:"I00001"
text:"Successful."

I searched the forums for the "Accept.js encryption failed" message and read some of the suggestions. One of them was to find out if my responseHandler function is getting called twice and IT IS. I can't figure out why it's being called twice. Here is my setup...

 

The onSubmit event on the form (specified in the render function of the component) is calling a function in the component called sendPaymentDataToAnet.

<AddPaymentProfileForm
     id="paymentForm"
     onSubmit={this.sendPaymentDataToAnet}
/>
sendPaymentDataToAnet = (event, paymentProfile) => {
    event.preventDefault();

    // ...

let self = this;
Accept.dispatchData(secureData, responseHandler);
function responseHandler(response) { console.log("responseHandler function called"); if (response.messages.resultCode === "Error") { // stopLoading(); var i = 0; while (i < response.messages.message.length) { console.log( response.messages.message[i].code + ": " + response.messages.message[i].text ); // only show the user the first error message if (i == 0) { var error = response.messages.message[i].text; self.alert("Error", error); } i = i + 1; } } else { paymentFormUpdate(response.opaqueData, paymentProfile); } } }

Accept.js is being loaded at the top of the web page before the component is defined in a <script> tag.

 

Any help is much appreciated. Thank you.

 

blackwood821
Contributor
Who Me Too'd this topic