Validate_Finance_CreditCard
[ class tree: Validate_Finance_CreditCard ] [ index: Validate_Finance_CreditCard ] [ all elements ]

Class: Validate_Finance_CreditCard

Source Location: /Validate_Finance_CreditCard-0.5.1/Validate/Finance/CreditCard.php

Class Overview


Credit card related information validation class


Author(s):

Version:

  • Release: @package_version@

Copyright:

  • 2005 The PHP Group

Methods


Inherited Variables

Inherited Methods


Class Details

[line 46]
Credit card related information validation class

This class provides methods to validate:

  • Credit card number
  • Card security code
  • Card type (i.e. Visa, Mastercard...)
The methods only check the format of the data. For instance the package does NOT check if a card is a legitimate card registered with a card issuer, or if the card is reported stolen, etc...



[ Top ]


Method Detail

cvv   [line 220]

bool cvv( string $cvv, string $cardType)

Validates a card verification value format

This method only checks for the format. It doesn't validate that the value is the one on the card.

CVV is also known as

  • CVV2 Card Validation Value 2 (Visa)
  • CVC Card Validation Code (MasterCard)
  • CID Card Identification (American Express and Discover)
  • CIN Card Identification Number
  • CSC Card Security Code
Important information regarding CVV: If you happen to have to store credit card information, you must NOT retain the CVV after transaction is complete. Usually this means you cannot store it in a database, not even in an encrypted form.

This method returns FALSE for card types that don't support CVV.

  • Return: TRUE if format is correct, FALSE otherwise
  • Access: public

Parameters:

string   $cvv   —  value to verify
string   $cardType   —  type/brand of card (case insensitive) "MasterCard", "Visa", "AMEX", "AmericanExpress", "American Express", "Discover", "Eurocard/MasterCard", "Eurocard"

[ Top ]

Luhn   [line 65]

bool Luhn( string $number)

Validates a number according to Luhn check algorithm

This function checks given number according Luhn check algorithm. It is published on several places, also here:


Parameters:

string   $number   —  to check

[ Top ]

number   [line 103]

bool number( string $creditCard, [string $cardType = null])

Validates a credit card number

If a type is passed, the card will be checked against it. This method only checks the number locally. No banks or payment gateways are involved. This method doesn't guarantee that the card is legitimate. It merely checks the card number passes a mathematical algorithm.


Parameters:

string   $creditCard   —  number (spaces and dashes tolerated)
string   $cardType   —  type/brand of card (case insensitive) "MasterCard", "Visa", "AMEX", "AmericanExpress", "American Express", "Diners", "DinersClub", "Diners Club", "CarteBlanche", "Carte Blanche", "Discover", "JCB", "EnRoute", "Eurocard", "Eurocard/MasterCard".

[ Top ]

type   [line 148]

bool type( string $creditCard, string $cardType)

Validates the credit card number against a type

This method only checks for the type marker. It doesn't validate the card number.


Parameters:

string   $creditCard   —  number (spaces and dashes tolerated)
string   $cardType   —  type/brand of card (case insensitive) "MasterCard", "Visa", "AMEX", "AmericanExpress", "American Express", "Diners", "DinersClub", "Diners Club", "CarteBlanche", "Carte Blanche", "Discover", "JCB", "EnRoute", "Eurocard", "Eurocard/MasterCard".

[ Top ]


Documentation generated on Mon, 11 Mar 2019 14:17:20 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.