Zendcasts Forum

A community of developers who work with the Zend Framework and other enterprise PHP technologies

You are not logged in.

#1 2010-04-26 22:45:51

Ryan Johnston
Member
Registered: 2010-03-08
Posts: 21

Zend Credit Card - Validation and Card Type

Hi,

So I know I can use Zend_Validate to Validate a Credit Card number against a list of "accepted" credit card types.

I was wondering if there is a similar feature / way to determine what type of credit card it is based on credit card number?

Cheers,
Ryan

Offline

#2 2010-04-27 02:21:24

Jon Lebensold
Administrator
Registered: 2009-06-27
Posts: 279

Re: Zend Credit Card - Validation and Card Type

Hi Ryan,

you could encapsulate these business rules into a Zend Web Service and be good to go:

http://www.merriampark.com/anatomycc.htm

Hope that helps,
-
Jon

Offline

#3 2010-04-27 02:28:38

Ryan Johnston
Member
Registered: 2010-03-08
Posts: 21

Re: Zend Credit Card - Validation and Card Type

Hey Jon,

Yeah I have it detecting now however there is a few problems with it's success based on what the banks have been doing.

http://en.wikipedia.org/wiki/Bank_card_number

Eg: Diners Club US and Mastercard eventually share the exact same prefix / length as "On November 8, 2004, MasterCard and Diner's Club formed an alliance." and differ based on region.

Now we do GeoIP the user but that's not 100% either.

I'm thinking the only solution will be when multiple card types are found to populate a dropdown box and ask the user to be more specific.

Frustrating haha, if only card prefix with length were independent. If Diners Club US had a different length to Mastercard then it would be easy but nope >.<

Offline

#4 2010-04-27 03:21:18

Ryan Johnston
Member
Registered: 2010-03-08
Posts: 21

Re: Zend Credit Card - Validation and Card Type

Well luckily we're not supporting cards like Diners Club US so everything works well smile

Cheers for that reference Jon big_smile

Offline

#5 2010-04-27 14:48:51

Jon Lebensold
Administrator
Registered: 2009-06-27
Posts: 279

Re: Zend Credit Card - Validation and Card Type

I was also thinking... I did some work with Authorize.net at one point and I'm not sure but they might hav had a call in their API to return the card type...

Offline

#6 2010-04-27 20:47:50

Ryan Johnston
Member
Registered: 2010-03-08
Posts: 21

Re: Zend Credit Card - Validation and Card Type

Yeah unfortunately the payment provider we are going with only takes credit card info / type etc to make a payment, no APIs to determine card type etc sad

Offline

#7 2010-05-07 04:10:57

Jaikinn33
New member
Registered: 2010-05-07
Posts: 1

Re: Zend Credit Card - Validation and Card Type

Hi
The details are all on Wikipedia: wikipedia.org/wiki/Credit_card_numbers
Good luck ...



---------------------
director search

Offline

#8 2010-05-07 05:16:50

Ryan Johnston
Member
Registered: 2010-03-08
Posts: 21

Re: Zend Credit Card - Validation and Card Type

Yes we saw this however it isn't as up-to-date as we hoped, all sorted now though smile Thanks for your help big_smile

Offline

Board footer

Powered by FluxBB