Brian Dunning's FileMaker Custom Functions

Luhn ( number )

The Luhn Mod-10 algorithm used to validate credit card numbers

  Average rating: 3.8 (43 votes) Log in to vote

Geoff Wells   Geoff Wells
DataIsland Software LLC
http://www.dataisland.com

Share on Facebook Share on Twitter

  Sample input:
Luhn ( 123456782 )
  Sample output:
1
// This is a valid Mod 10 number

  Function definition: (Copy & paste into FileMaker's Edit Custom Function window)

The Luhn Mod-10 algorithm is used to validate ( check for input errors ) of many credit cards and Canadian Social Security numbers.

 

Comments

Chris   Chris, NY
Jul 15, 2009
This function is perfect. Thank you for your good comments.
 
Dave C.   Dave C., Vancouver, Canada
May 1, 2015
Works great (once I realized I needed to put in 'number' as a parameter for Luhn, 'doubleEven' for LuhnProduct; and 'makeEven' for LuhnDoubleEven).
 
Will Loving   Will Loving, Dedication Technologies, Inc.
Mar 18, 2019
I'm testing this with a (fake but valid) China UnionPay 19-digit card number: 6264077021846833676 The card generator I'm using says it passes Luhn but it fails your Luhn Custom Function test along with any credit card validator based on it... Does the calculation require revision to handle 19-digit numbers?
 

Log in to post comments.

 

Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.

Support this website.

This library has been a free commmunity resource for FileMaker users and developers for 15 years. It receives no funding and has no advertisements. If it has helped you out, I'd really appreciate it if you could contribute whatever you think it's worth:

Under construction. Email me your wish list for improvements.