cancel
Showing results for 
Search instead for 
Did you mean: 

accept.js - purpose

So I thought accept.js was the answer to my integration. Post credit card details directly from the client browser to auth.net and it never even hits my servers. Just save the token (or nonce).  But I'm finding it only works once?!  If i enter a new card and save it, then post a transaction, it works, but only the first time.

 

Did I misunderstand the purpose of accept.js?  Is it supposed to only work once?

rickstout
Member
20 REPLIES 20

I keep seeing mention of "Nonce", what is that value and where do I get it?

It's in the response data returned from an Accept.js submission. The data returned is a JSON object and the nonce can be found at response.opaqueData.dataValue. Note: response is what I named my object, but it's whatever you name the argument in these functions, taken from the API feature page:

 

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 = '6WrfHGS76gHW3v7btBCE3HuuBukej96Ztfn5R32G5ep42vne7MCWZtAucY';
	authData.apiLoginID = 'my_api_login_id';
	secureData.authData = authData;
	
	Accept.dispatchData(secureData, 'responseHandler');
}

//called by Accept.dispatchData when auth.net sends back a response
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);
        }
    } else {
        useOpaqueData(response.opaqueData)
    }
}

Here's the feature page I lifted the code from (steps 3+4), just for reference: http://developer.authorize.net/api/reference/features/acceptjs.html

Is there a way to validate an Accept.js card nonce before we save it to a Customer Profile?  Or does Accept.js do that automatically?

 

I'm trying to avoid saving the profile based off of the nonce, then trying to run a transaction only to find out the card is bad. 

firebird
Member

Hello @firebird

 

When creating the nonce, the gateway performs some basic MOD10 on the card number, expiry check, etc. but does not validate the card.

 

If you use the nonce to create a customer profile and set validationMode as LiveMode, it will validate the card and only create a profile if the validation is successful.

 

Richard

So it the Nonce from Accept.js reusable yet? If you save it to a customer profile can you use it to execute future transactions and/or setup recurring transactions based on that profile?

 

If not is there another solution using Accept.js to setup recurring payments?

Hello @wilogic

 

They payment nonce can only be used once, but it can be used to create a transaction, a customer profile or to create a subscription.  Accept.js allows developers to maintain control over the user experience while reducing PCI scope because sensitive card data never passes through your server.

 

Richard

"They payment nonce can only be used once, but it can be used to create a transaction, a customer profile or to create a subscription."

 

Is it possible to do more than 1 un-equal transactions randomly using "accept.js" method?

Say a payment of $200 after 1 week, then $1000 after 1 month and finally another $2000 after 2.5 months.

Hello @rakeshjst123

 

The nonce can only be used once as mentioned above.  But if you create a customer profile, you can create subsequent transactions using the customer profile.

 

Richard

just so i can clear... i currently make use of CIM without using accept.js.

for a new integration of this accept.js library, i get my nonce, and i can then use it to create a customer payment profile. once i have the customer payment profile i can then use that for card on file transactions similar to what i am currenty doing.

is that correct?

thanks.

Hi @prose_la,

 

That's correct!