1CreditCard(3)         User Contributed Perl Documentation        CreditCard(3)
2
3
4

NAME

6       "Business::CreditCard" - Validate/generate credit card checksums/names
7

SYNOPSIS

9           ##
10           # new-style, supported since 0.36 released Jun 14 2016
11           ##
12
13           use Business::CreditCard qw( 0.36 :NEW );
14
15           print validate_card("5276 4400 6542 1319");
16           print cardtype("5276 4400 6542 1319");
17
18
19           ##
20           # old interface, deprecated but still supported for backwards compatibility
21           ##
22
23           use Business::CreditCard;
24
25           print validate("5276 4400 6542 1319");
26           print cardtype("5276 4400 6542 1319");
27
28       Business::CreditCard is available at a CPAN site near you.
29

DESCRIPTION

31       These subroutines tell you whether a credit card number is self-
32       consistent -- whether the last digit of the number is a valid checksum
33       for the preceding digits.
34
35       The validate_card() subroutine returns 1 if the card number provided
36       passes the checksum test, and 0 otherwise.
37
38       The cardtype() subroutine returns a string containing the type of card.
39       The list of possible return values is more comprehensive than it used
40       to be, but additions are still most welcome.
41
42       Possible return values are:
43
44         VISA card
45         MasterCard
46         Discover card
47         American Express card
48         enRoute
49         JCB
50         BankCard
51         Switch
52         Solo
53         China Union Pay
54         Laser
55         Isracard
56         Unknown
57
58       "Not a credit card" is returned on obviously invalid data values.
59
60       Versions before 0.31 may also have returned "Diner's Club/Carte
61       Blanche" (these cards are now recognized as "Discover card").
62
63       cardtype() will accept a partial card masked with "x", "X", ".", "*" or
64       "_".  Only the first 2-6 digits and the length are significant;
65       whitespace and dashes are removed.  With two digits, Visa, MasterCard,
66       Discover and Amex are recognized (versions before 0.36 needed four
67       digits to recognize all Discover cards).  With four digits, almost all
68       cards except some Switch cards are recognized.  With six digits (the
69       full "BIN" or "IIN"), all cards are recognized.  Six digits are also
70       required for receipt_cardtype().
71
72       The generate_last_digit() subroutine computes and returns the last
73       digit of the card given the preceding digits.  With a 16-digit card,
74       you provide the first 15 digits; the subroutine returns the sixteenth.
75
76       This module does not tell you whether the number is on an actual card,
77       only whether it might conceivably be on a real card.  To verify whether
78       a card is real, or whether it's been stolen, or to actually process
79       charges, you need a Merchant account.  See Business::OnlinePayment.
80
81       These subroutines will also work if you provide the arguments as
82       numbers instead of strings, e.g. validate_card(5276440065421319).
83

PROCESSING AGREEMENTS

85       Credit card issuers have recently been forming agreements to process
86       cards on other networks, in which one type of card is processed as
87       another card type.
88
89       By default, Business::CreditCard returns the type the card should be
90       treated as in the US.  You can change this to return the type the card
91       should be treated as in a different country by setting
92       $Business::CreditCard::Country to your two-letter country code.  This
93       is probably what you want to determine if you accept the card, or which
94       merchant agreement it is processed through.
95
96       You can also set $Business::CreditCard::Country to a false value such
97       as the empty string to return the "base" card type.  This is probably
98       only useful for informational purposes when used along with the default
99       type.
100
101       Here are the currently known agreements:
102
103       Most Diner's club is now identified as Discover.  (This supercedes the
104       earlier identification of some Diner's club cards as MasterCard inside
105       the US and Canada.)
106       JCB cards in the 3528-3589 range are identified as Discover inside the
107       US and territories.
108       China Union Pay cards are identified as Discover cards in the US,
109       Mexico and most Caribbean countries.
110

RECEIPT REQUIREMENTS

112       Discover requires some cards processed on its network to display
113       "PayPal" on receipts instead of "Discover".  The receipt_cardtype()
114       subroutine will return "PayPal card" for these cards only, and
115       otherwise the same output as cardtype().
116
117       Use this for receipt display/printing only.
118
119       Note: this subroutine is not exported by default like the others.
120       Before 0.36, you needed to call this subroutine fully-qualified, as
121       Business::CreditCard::receipt_cardtype()
122
123       In 0.36 and later, you can import it into your namespace:
124
125         use Business::CreditCard qw( :DEFAULT receipt_cardtype );
126

ORIGINAL AUTHOR

128       Jon Orwant
129
130       The Perl Journal and MIT Media Lab
131

MAINTAINER

133       Current maintainer is Ivan Kohler <ivan-business-creditcard@420.am>.
134
135       Lee Lawrence <LeeL@aspin.co.uk>, Neale Banks <neale@lowendale.com.au>
136       and Max Becker <Max.Becker@firstgate.com> contributed support for
137       additional card types.  Lee also contributed a working test.pl.
138       Alexandr Ciornii <alexchorny@gmail.com> contributed code cleanups.
139       Jason Terry <jterry@bluehost.com> contributed updates for Discover BIN
140       ranges.
141
143       Copyright (C) 1995,1996,1997 Jon Orwant Copyright (C) 2001-2006 Ivan
144       Kohler Copyright (C) 2007-2021 Freeside Internet Services, Inc.
145
146       This library is free software; you can redistribute it and/or modify it
147       under the same terms as Perl itself, either Perl version 5.8.8 or, at
148       your option, any later version of Perl 5 you may have available.
149

HOMEPAGE

151       Homepage:  http://perl.business/creditcard
152

REPOSITORY

154       The code is available from our public git repository:
155
156         git clone git://git.freeside.biz/Business-CreditCard.git
157
158       Or on the web:
159
160         http://freeside.biz/gitweb/?p=Business-CreditCard.git
161         Or:
162         http://freeside.biz/gitlist/Business-CreditCard.git
163

BUGS

165       (paraphrasing Neil Bowers) We export all functions by default.  It
166       would be better to let the user decide which functions to import.  And
167       validate() is a bit of a generic name.
168
169       The question is, after almost 2 decades with this interface (inherited
170       from the original author, who probably never expected it to live half
171       this long), how to change things to behave in a more modern fashion
172       without breaking existing code?  "use Business::CreditCard
173       <some_minimum_version>" turns it off?  Explicitly ask to turn it off
174       and list that in the SYNOPSIS?
175
176   validate() and @EXPORT transition plan
177       First (done in 0.36):
178
179       validate_card() is the new name for validate().  Both work for now.
180
181       New-style usage (not recommended for code that needs to support B:CC
182       before 0.36):
183
184         use Business::CreditCard qw( :NEW );
185
186       You get validate_card(), cardtype() and receipt_cardtype().  You can
187       also ask for them explicitly / individually:
188
189         use Business::CreditCard qw( validate_card cardtype receipt_cardtype );
190
191       Second:
192
193       Waiting for 0.36+ to become more prevalent.
194
195       Third (we're at now now):
196
197       Recommend new-style usage.  Maybe asking for a specific minimum version
198       turns it on too?
199
200       Fourth:
201        (this is the incompatible part):
202
203       Don't export validate() (or anything else [separately?]) by default.
204
205       This is the part that will break things and we probably won't do for a
206       long time, until new-style usage is the norm and the tradeoff of
207       breaking old code is worth it to stop our namespace pollution.  Maybe
208       do a 1.00 release with the current API and 2.00 is when this happens
209       (with a 1.99_01 pre-release)?
210

SEE ALSO

212       Business::CreditCard::Object is a wrapper around Business::CreditCard
213       providing an OO interface.  Assistance integrating this into the base
214       Business::CreditCard distribution is welcome.
215
216       Business::OnlinePayment is a framework for processing online payments
217       including modules for various payment gateways.
218
219       http://neilb.org/reviews/luhn.html is an excellent overview of similar
220       modules providing credit card number verification (LUHN checking).
221
222
223
224perl v5.38.0                      2023-07-20                     CreditCard(3)
Impressum