Wednesday, February 16, 2011

How does Dynamics NAV validates the Credit Card number for Online Payments

Dynamics NAV 2009 R2 has a new feature called “Online Services” and using this functionality you can accept and process credit card payments in Microsoft Dynamics NAV.This online credit card payment feature automates authorizing credit card amounts at the time of the order and processing the actual charge when the order is shipped and invoiced.

In order to use this online payment services, you need to setup payment services, customer payment methods and credit cards for the customers. While setting up the Number field in the Credit Card page (Customer Card—>Customers—>Credit Cards), Dynamics NAV automatically validates value for the correct credit card number and gives the error message for invalid credit card numbers.

image

This validation is not a real credit card number validation from the service providers but uses the algorithm called “Modulus10”. This algorithm was designed to protect against accidental errors, not malicious attacks. Most credit cards and many government identification numbers use the algorithm as a simple method of distinguishing valid numbers from collections of random digits. You can find the related C/AL code in the codeunit 827 “DO Payment Card Validation” function “IsModulus10”.