Are there "fake" credit card numbers I can use to test my integration?
Hey guys,
I'm fumbling along with the API doc and slowly making progress. Two questions:
-
Is there a fake CC number/expiration date/ZIP that I can input to test that my integration works properly? (I've been entering random numbers and am getting "'4211111111111111' is not a valid credit card number" errors.
-
I'm pretty new to RoR, but can you point me to some tips on how to handle the exceptions that get thrown when the card fails validation like this? (I'm asking new users to put this info in during the signup process and can't figure out how to get these errors to go into the standard form error messages that appear when a Rails validation fails...)
Thanks!
Paul
Discussions are closed to public comments.
If you need help with Cheddar please
start a new discussion.
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
1 Posted by Paul Singh on 25 Nov, 2009 11:42 PM
Actually, I found a few "fake" CC numbers that seem to work... in case anyone else runs into the same question, here's what worked for me.
FROM AUTHORIZE.net DOCS
370000000000002 American Express
6011000000000012 Discover
5424000000000015 MasterCard
4007000000027 Visa
So now all I need help with is how to properly do error handling when/if CG throws an exception, etc. Any tips?
Paul
Support Staff 2 Posted by Marc Guyer on 26 Nov, 2009 03:59 PM
I don't yet know the answer to your question about Ruby exception handling. It being thanksgiving day and all, I'll probably find it difficult to find someone to answer it. I'll try to find some time today to figure it out. I'd like to write a knowledge base article on the subject anyway. Let me know if you figure it out in the meantime.
Support Staff 3 Posted by Marc Guyer on 26 Nov, 2009 08:02 PM
Are you using the Hashrocket API wrapper?
4 Posted by Jon Larkowski on 27 Nov, 2009 02:35 AM
Paul, if you use Hashrocket's Mousetrap wrapper, it will raise errors when the CheddarGetter API returns error response codes. You can then catch those errors, and add them to your ActiveRecord errors collection. You do it in your model code, a little something like this...
That's the best I can do right now to get ya started. There's a bunch of other little complexities and special cases that come up, but this is the essence: make CheddarGetter communication part of your regular model validation lifecycle.
5 Posted by Paul Singh on 27 Nov, 2009 03:47 PM
Hey guys,
For now, I've been using ADS' cheddargetter API wrapper... I'll take a closer look at the Hashrocket implementation though. Off the top of my head, it shouldn't be too hard for me to change over at this point.
@Jon: Thanks for the example code -- that actually helps get me started pretty well!
@Marc: Let me know when you start to put that doc together -- I'd be happy to help out.
Paul
Support Staff 6 Posted by Marc Guyer on 29 Nov, 2009 03:13 AM
I'd suggest using the hashrocket implementation. It is certainly the most mature at this point.
Marc Guyer closed this discussion on 05 Apr, 2010 08:04 PM.