cancel
Showing results for 
Search instead for 
Did you mean: 

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. https://developer.authorize.net/hello_world/testing_guide/
glyoder
Contributor
1 ACCEPTED SOLUTION

Accepted Solutions

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.

View solution in original post

4 REPLIES 4

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.

 

Richard

RichardH
Administrator Administrator
Administrator

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.

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.

How does this work when using the hosted form?  The Accept.js response does not include the zip code.

 

https://developer.authorize.net/api/reference/features/acceptjs.html#Handling_the_Response