Posts: 20
Registered: ‎02-24-2017
Accepted Solution

How to test declines with Accept.JS

If I'm using a paymentNonce generated by Accept.JS to perform a transaction, how do I test declines? The transaction amount triggers have apparently been deprecated in favor of zip codes, but Accept.JS doesn't take a zip code.
Posts: 2,282
Topics: 51
Kudos: 153
Blog Posts: 64
Registered: ‎12-05-2011

Re: How to test declines with Accept.JS

[ Edited ]

Hello @glyoder


The Accept.js library is used solely to create a one-time token, it does not actually perform any additional validation other than simple mathmatical checks.


When you use createTransactionRequest to submit the nonce or one-time token, that is where you can use the testing guide to trigger a decline.




Webhooks are now available for Authorize.Net

Using SOAP, see our deprecation notice.
Check out Accept.js, our Javascript replacement for DPM.
Pro Tip: Never use test mode in the sandbox, instead use the Testing Guide.
Posts: 20
Registered: ‎02-24-2017

Re: How to test declines with Accept.JS

[ Edited ]

Understood, but we don't ask for a zip code in our use case -- we go straight from payment nonce to transaction with minimal info. Since payment amounts no longer trigger an error, I'm not sure how to proceed.

Posts: 381
Registered: ‎11-03-2016

Re: How to test declines with Accept.JS

Hi @glyoder,


The Accept.js does take a zip code. If you'd like to test a decline, your best bet would be to insert code that sends the appropriate zip code in with your dispatchData call. Even if your form isn't asking for a zip code, you can still send the value in with your script.


Alternatively, even though our testing guide mentions that testing based on amounts is deprecated, it does still work for now. Sending a transaction of 70.02 through Accept.js will result in a decline.


Aaron Wright
Developer Advocate - Authorize.Net

Follow Authorize.Net developer news on Twitter!