Reply
Member
Posts: 1
Registered: ‎03-29-2017

Not Getting Payment Nonce

We have tried to get Payment Nonce as defined in example in following URL but we are not getting response, we are using developer sandbox account.

 

http://developer.authorize.net/api/reference/features/acceptjs.html

 

When we give right test credit it’s not giving any response.

 

<script type="text/javascript" src="https://js.authorize.net/v1/Accept.js" charset="utf-8"></script>

<!-- For Sandbox/Testing use -->

<script type="text/javascript" src="https://jstest.authorize.net/v1/Accept.js" charset="utf-8"></script>

<script type="text/javascript">

 

function sendPaymentDataToAnet() {

var secureData = {}, authData = {}, cardData = {};

 

            cardData.cardNumber = document.getElementById('CARDNUMBER_ID').value;

            cardData.month = document.getElementById('EXPIRY_MONTH_ID').value;

            cardData.year = document.getElementById('EXPIRY_YEAR_ID').value;

 

            secureData.cardData = cardData;

            authData.clientKey = 'OurClientKey';

            authData.apiLoginID = 'OurAPILoginID';

            secureData.authData = authData;

            Accept.dispatchData(secureData, 'responseHandler')

 

        }

 

 

function responseHandler(response) {

if (response.messages.resultCode === 'Error') {

for (var i = 0; i < response.messages.message.length; i++) {

                    console.log(response.messages.message[i].code + ':' + response.messages.message[i].text);

                    alert(response.messages.message[i].text);

                }

            } else {

                console.log(response.opaqueData.dataDescriptor);

                console.log(response.opaqueData.dataValue);

                alert("test");

            }

        }

 

function useOpaqueData(responseData) {

 

// This is where you would set the data descriptor & data value to be posted back to your server

            console.log(responseData.dataDescriptor);

            console.log(responseData.dataValue);

            alert(responseData.dataValue);

        }

 

</script>

All Star
Posts: 699
Registered: ‎11-03-2016

Re: Not Getting Payment Nonce

Can you provide any more details? Are you getting any error messages? What does your html code look like that's calling the script?

 

Is the nonce showing up in the console or are you getting any other messages there?