Showing results for 
Search instead for 
Did you mean: 

Testing a credit card that is supposed to decline but gets accepted

In developer mode, I've tested credit cards that usually give the correct response (invalid expiration date, invalid card number, accepted, etc.). However, when I enter in my credit card and intentionally put in something incorrect (such as wrong year) and pass it through, it goes through as accepted. This shouldn't happen because it's not an actual valid card, yet I can't seem to get the proper error response to appear, just that it's accepted. 

How can I go about getting this to work in development? This applies to any scenario where a card should be declined and the transaction shouldn't return a success, but still does.


In the production system the expiration date will be passed on through the system to be validated by the card issuer. In the sandbox there are no live processor connections and the transaction will not reach the issuer. As a result, an expired card will not result in a decline in the test system unless you use the test triggers.


Using the Transaction Amount Triggers, submit a request with the amount of $8 to generate an expired card response.


Administrator Administrator

An expired card works; I meant that I'd enter in the incorrect expiration date (2023 instead of 2024, for example) and it would still go through, or if I test a card that has no more credit available and still gets "charged". 

The same principle applies - the sandbox doesn't go out to the card issuer so the responses are simulated. Due to that, no expiration dates or card verifications (outside of basic field & data type validations) occur in the sandbox.


In the cases you have described, the simulator will return a successful response.

So is there any way to test the cases I've mentioned in a non-live environment, or do I just have to test in a live environment and debug from there?

See the Testing Guide.  You set the Bill-to zip to certain values to get a different return.

Regular Contributor