You can verify credit card numbers by using Luhn formula, or modulus 10 formula it's also called.
BUT you can't verify the validity of a credit card entirely ( whether or not its expired, whether or not they have money left, CCV2 number verification, whether they've cancelled it, etc. ) without a merchent account or some other gateway to a credti card processor.