Your users might be presented with a form like this:

Please enter your coupon code:

An example code might look like this:

    T13P-2LMP-E0B5

This code could be entered as: ti3pzlmpeobs (try it now to see the auto-correction in action).

More sample codes:

    T13P-2LMP-E0B5
    HA0B-R1W6-76JH
    5QMU-M10M-VE0D
    FLY6-9A0E-NFHN
    TYPQ-F3UV-QC2M
    72JJ-J9C1-Y5GB
    DQV8-YAL9-RW4R
    EA9N-QVAF-PRPM
    PM98-W5MX-1RD5
    2HCB-VRLH-6B2E
    7D3T-W0BJ-4NE9

CouponCodes are designed to be distributed in printed form and typed into a web form. Features of the codes that make them well suited to manual transcription:

  • The codes are not case sensitive.
  • Not all letters and numbers are used, so if a person enters the letter 'O' we can automatically correct it to the digit '0' (similarly for I ⇨ 1, S ⇨ 5, Z ⇨ 2).
  • The 4th character of each part is a checkdigit, so client-side scripting can be used to highlight parts which have been mis-typed, before the code is even submitted to the application's back-end validation.
  • The checkdigit algorithm takes into account the position of the part being keyed. So for example '1K7Q' might be valid in the first part but not in the second so if a user typed the parts in the wrong boxes then their error could be highlighted.
  • The code generation algorithm avoids 'undesirable' codes. For example any code in which transposed characters happen to result in a valid checkdigit will be skipped. Any generated part which happens to spell an 'inappropriate' 4-letter word (e.g.: 'P00P') will also be skipped.

Codes can be generated and validated on the server using the Algorithm::CouponCode Perl Module.

Code and documentation are now available on CPAN.