You are probably here because you want to validate routing and bank account numbers. There is good and bad news.
Good news
US bank routing numbers follow a very strict format. That makes it so you can easily validate it and be assured that before you send that data to the back-end it passes the format requirements.
Bad News
Bank account numbers are not so fortunate. There is no strict format unlike IBAN. Dang it! I discuss is more here.
Routing Number
You can get really fancy and do some really deep validation for the routing number. As you can see here there is a lot behind the format including what each set of digits represents (what kind of institution is the bank, what Federal Reserve district it is in, which state its in, etc).
But we are going to keep it simple. There is a checksum. Thanks to BrainJar for presenting a simple solution.
First off the number is always 9 digits.
Next is the checksum algorithm.
Here is our example routing number:
324377516
(3 x 3) + (2 x 7) + (4 x 1) +
(3 x 3) + (7 x 7) + (7 x 1) +
(5 x 3) + (1 x 7) + (6 x 1) = 120
(3 x 3) + (7 x 7) + (7 x 1) +
(5 x 3) + (1 x 7) + (6 x 1) = 120
If the total is an exact multiple of 10 (no remainder) then it passes the checksum and is valid.
120 % 10 == 0
Here is my javascript method:
function validateABA(n) { n = n ? n.match(/\d/g).join('') : 0;//get just digits var c = 0, isValid = false; if (n && n.length == 9){//don't waste energy totalling if its not 9 digits for (var i = 0; i < n.length; i += 3) {//total the sums c += parseInt(n.charAt(i), 10) * 3 + parseInt(n.charAt(i + 1), 10) * 7 + parseInt(n.charAt(i + 2), 10); } isValid = c != 0 && c % 10 == 0;//check if multiple of 10 } return {//return an object telling whether its valid and if not, why. isValid: isValid, errorMsg: n.length != 9 ? 'Rounting number must be 9 digits' : (!isValid ? 'Invalid bank routing number.' : '')//determine the error message }; }
Bank Account Number
Since there is no format for bank account numbers there isn't a ton you can do except for cover the basics. This leaves people having to speculate, so we will cover the best we can by understanding the speculations.
Account numbers range from 4-17 characters, but some claim they have seen as little as 2. You can most likely safely assume that its only going to be numbers, but nothing strictly says that there won't be letters. You could force numbers only until the first person complains, or just leave it up to the payment gateway at that point since we are only trying to give the best data we can to the back-end.
So what I did was just require it to be at least 2 characters and no longer than 17.
There you have it. With that you should be able to filter enough to get valid routing and account numbers for the US.
Thanks for presenting a simple solution.
ReplyDeleteI once had a moment when I urgently needed fairwinds routing number, but I could not find it in the documents and I had absolutely no time to call the bank to find out. I think it was one of my most brilliant ideas to start searching for information on the Intnet. I found a great site where you can find a number by the name of a bank and a bank by number. And don't have to multiply anything!
ReplyDeleteYour website is really cool and this is a great inspiring article. Phonepe customer care
ReplyDeleteBank routing is used to connote which money related organization a check starts from. This can be significant on a number of levels and can be checked on the web. us bank routing number
ReplyDeleteI wanted to thank you for this great read!! I definitely enjoying every little bit of it I have you bookmarked to check out new stuff you post. test bank
ReplyDeleteNice, but the JavaScript should also check to see if the first two digits are between 01 and 12.
ReplyDeletei am always looking for some free stuffs over the internet. there are also some companies which gives free samples. 먹튀검증
ReplyDeletePretty good post. I have just stumbled upon your blog and enjoyed reading your blog posts very much. I am looking for new posts to get more precious info. Big thanks for the useful info. here
ReplyDeletePretty nice post. I just stumbled upon your weblog and wanted to say that I have really enjoyed browsing your blog posts. After all I’ll be subscribing to your feed and I hope you write again soon! 먹튀검증
ReplyDeleteGreat post, you have pointed out some fantastic points , I likewise think this s a very wonderful website. 먹튀검증
ReplyDeleteWhat a thrilling post, you have pointed out some excellent points, I as well believe this is a superb website. I have planned to visit it again and again. 토토커뮤니티
ReplyDeleteGreat articles and great layout. Your blog post deserves all of the positive feedback it’s been getting. 먹튀검증
ReplyDeleteI high appreciate this post. It’s hard to find the good from the bad sometimes, but I think you’ve nailed it! would you mind updating your blog with more information? Primewire
ReplyDeleteYes i am totally agreed with this article and i just want say that this article is very nice and very informative article.I will make sure to be reading your blog more. You made a good point but I can't help but wonder, what about the other side? !!!!!!Thanks 대전1인샵
ReplyDeleteLiposuction should never be considered an alternative to a healthy lifestyle, it is one of the steps that can get you to a better version of yourself through fat reduction. patient story
ReplyDeleteI think this is an informative post and it is very beneficial and knowledgeable. Therefore, I would like to thank you for the endeavors that you have made in writing this article. All the content is absolutely well-researched. Thanks... 현금바둑이
ReplyDeleteThankyou for this wondrous post, I am glad I observed this website on yahoo. test bank nursing
ReplyDeleteVery useful post. This is my first time i visit here. I found so many interesting stuff in your blog especially its discussion. Really its great article. Keep it up. 먹튀검증
ReplyDeleteSuperbly written article, if only all bloggers offered the same content as you, the internet would be a far better place.. 온라인바둑이
ReplyDeleteThank you so much as you have been willing to share information with us. We will forever admire all you have done here because you have made my work as easy as ABC. 토토사이트
ReplyDeleteIf you are looking for more information about flat rate locksmith Las Vegas check that right away. playist
ReplyDeleteI wanted to thank you for this great read!! I definitely enjoying every little bit of it I have you bookmarked to check out new stuff you post. playist
ReplyDeleteI have read all the comments and suggestions posted by the visitors for this article are very fine,We will wait for your next article so only.Thanks! unique domain
ReplyDeleteLuckyClub Casino Site Review (2021) - Live Dealer
ReplyDeleteLuckyClub Casino ✓ Trusted Live Dealer Casino Reviews. Sign up today and claim your Welcome bonus ✓ Welcome bonus up to €150 + 200 FS luckyclub.live at LuckyClub.
I hope many people know good information here. I will put favorites. 토토사이트
ReplyDeleteHi! This is my first visit to your blog! Blog gave us useful information to work 먹튀보증업체
ReplyDeleteAppreciate it for this post, I am a big fan of this website would like to keep updated. 토토
ReplyDeleteThank you very much for sharing this article. It helped me a lot and made me feel a lot. Please feel free to share such good information. 스포츠토토사이트
ReplyDelete보증업체 hank you for the information provided! Maintain the good performance of your site. You can also check my article
ReplyDeleteWhile you’ll discover extra on-line slots than tables regardless of the place you go, our prime https://casino.edu.kg/yesbet88.html on-line casinos welcome skill gamers with open arms. Oh, and a few websites - like Bovada - even supply sports betting. Ignition Casino is America’s go-to on-line casino for real cash payouts across 300+ slots, table video games and big cash poker tournaments.
ReplyDeleteI want to take a moment to share my experience with LinkBuilder.info, an exceptional link building agency that has truly transformed my website's traffic. In today's competitive digital landscape, driving organic traffic is crucial for online success, and LinkBuilder.info has proven to be a game-changer. With their wealth of expertise and a solid track record, LinkBuilder.info stands out as a leading player in the industry. Their team of seasoned professionals understands the intricate dynamics of link building and implements proven strategies aligned with the latest SEO best practices. What sets them apart is their commitment to a comprehensive and tailored approach. They take the time to analyze your website's specific needs, industry, and target audience, crafting a customized link building strategy that yields exceptional results. By leveraging their extensive network of high-quality, authoritative websites relevant to your niche, LinkBuilder.info secures powerful backlinks that not only drive organic traffic but also enhance your website's online reputation. https://linkbuilder.info
ReplyDelete