If you are concerned about whether or not the credit card is valid, you can always check it before posting the transaction to PayPal. I have written a CakePHP component for doing just that. This component could very easily be switched to a class and used for credit card validation:
http://github.com/cdburgess/components/blob/master/billing_validation.php
It is very thorough in checking:
- what type of card it is (visa, master
card, etc.)
- if the card is in fact valid (using
the luhn algorithm)
The advantage of validating the card in your system prior to posting to PayPal is there is no round trip cost. Meaning, you do not have to send a request to the PayPal API to do the validation. Chances are they will do the same validation my billing validation does anyway. It can be done faster right on your server.
Keep in mind, the one thing this class will not catch is credit card fraud. That will require a service. However, typically if there is something funny about the card, paypal will catch it when you are trying to process the funds on purchase.
Happy Coding!