Last updated: 31 March 2026 | Change log
Luhn compliance refers to the implementation of the Luhn algorithm, which is a simple checksum formula used to validate identification numbers such as card numbers. It is widely used in the payments industry to verify the integrity of card numbers entered by your customers.
The algorithm ensures that the card number is formatted correctly and helps detect accidental errors such as mistyped or incomplete numbers.
Enabling Luhn compliance in your checkout process ensures:
Input validation
Card numbers entered by customers are checked for basic formatting errors before being submitted for processing.Improved user experience
Customers are notified immediately if they enter an invalid card number, reducing failed transactions.Compliance with industry standards
Many payment systems require Luhn validation as part of their card number verification process.
Disabling Luhn compliance allows the SDK to accept card numbers that do not pass the Luhn algorithm validation. This might be necessary in the following scenarios:
Support for non-Luhn compliant cards
Some card issuers use card numbers that do not conform to the Luhn algorithm. Disabling the check ensures these cards can be processed.Testing and debugging
During development or testing, you may need to use test card numbers that fail the Luhn check.Custom business requirements
Certain business models or integrations may require accepting card numbers regardless of their compliance with the Luhn algorithm.
By default, we enable Luhn compliance checks within the SDK. This means that unless explicitly disabled, we always do these checks. If a card fails the Luhn check, the SDK doesn't allow the creation of a session. If you would like to take payments with non-Luhn compliant cards you can do so by:
- setting
allowNonLuhnCompliantCardstotruein theWorldpay.checkout.initmethod when you initialize the SDK. This allows the SDK to accept card numbers that do not pass the Luhn check.
Worldpay.checkout.init({
// other configuration options
allowNonLuhnCompliantCards: true
});