Popular recipes tagged "credit"http://code.activestate.com/recipes/tags/credit/popular/2011-08-11T19:06:58-07:00ActiveState Code RecipesCredit Card Validation (Python)
2011-08-11T19:06:58-07:00Stijn de Graafhttp://code.activestate.com/recipes/users/4178055/http://code.activestate.com/recipes/577838-credit-card-validation/
<p style="color: grey">
Python
recipe 577838
by <a href="/recipes/users/4178055/">Stijn de Graaf</a>
(<a href="/recipes/tags/card/">card</a>, <a href="/recipes/tags/credit/">credit</a>, <a href="/recipes/tags/false/">false</a>, <a href="/recipes/tags/number/">number</a>, <a href="/recipes/tags/testing/">testing</a>, <a href="/recipes/tags/true/">true</a>, <a href="/recipes/tags/validating/">validating</a>, <a href="/recipes/tags/validation/">validation</a>).
</p>
<p>Test validity of any credit card number using the LUHN method (mod 10).
Starting at the last digit and moving backwards, you add up every other digit.
Then, you double the left-out digits, and add the digits of these results to the original sum.
If this satisfies sum mod 10 == 0 then the card is valid.</p>
<p>This is also explained at <a href="http://www.beachnet.com/%7Ehstiles/cardtype.html" rel="nofollow">http://www.beachnet.com/~hstiles/cardtype.html</a></p>
Determine credit card type by number (Python)
2011-08-01T13:41:09-07:00Paul Saparovhttp://code.activestate.com/recipes/users/4178836/http://code.activestate.com/recipes/577815-determine-credit-card-type-by-number/
<p style="color: grey">
Python
recipe 577815
by <a href="/recipes/users/4178836/">Paul Saparov</a>
(<a href="/recipes/tags/card/">card</a>, <a href="/recipes/tags/credit/">credit</a>).
</p>
<p>Simple function that determines cc type by number</p>