that.dork.jordan
Testing failed transactions with Authorize.net’s CIM and AIM APIs

I’ve been working on a checkout page for Social Sonar (check the site out if you have or know of a business that needs social media help!) and most of building a checkout is old news, but one thing is always a major pain: testing the credit card processing. There are a thousand docs telling you how to test a successful transaction, but what about declined transactions! *chirp chirp*

I’m putting this here partially so I have a place to refer back to in however many months when I end up having to do this again, and partially hoping that the next person who runs into this doesn’t have so much trouble. These are some things I learned while integrating with Authorize.net using the Authorize Sauce Python library:

  • You can test different transaction statuses by using the card number 4222-222-222-222 by providing special dollar values. Yes, that is a 13 digit, not a 16 digit card number.
  • If you are testing the CIM API, the API that allows you to store a credit card on Authorize.net’s servers and then charge it later using a token they give you, the dollar values are difficult to find. That’s why I’m including them right here.
  • If you are testing the AIM API, the API that requires you to post the full credit card number with every transaction, the dollar values are pretty simple. Whatever response reason code you want returned, charge that as the whole dollar amount. For example, if you want to test out a duplicate transaction, charge $11.00. The response reason codes are here.
  • Most libraries will not allow you to use 4222-222-222-222 as a credit card number. It doesn’t pass LUHN, and some code might notice the 4, expect a Visa, and not allow a 13 digit card number. You’ll have to work around this unfortunately. I added some code that looks for this card number and if it’s in test mode, it allows it. The code is ugly, so I’m not releasing a patch for anything.
  • You cannot do this if x_test_request is Y.
Share
You can leave a response, or trackback from your own site.
  • maaaaattttt

    <3 you're so clever