ابدأ بالتواصل مع الأشخاص وتبادل معارفك المهنية

أنشئ حسابًا أو سجّل الدخول للانضمام إلى مجتمعك المهني.

متابعة

Hello expertise, I want to check is Credit Card and other provided cards numbers are valid before sending request to my payment gateway ?

Please share you best thoughts as a best suggestion. Many thanks in advance. :)

user-image
تم إضافة السؤال من قبل Muhammad Abid Saleem , Software Engineer , PVT Company LTD lahore
تاريخ النشر: 2013/12/15
Muhammad Majid Saleem
من قبل Muhammad Majid Saleem , Senior PHP Developer / Project Manager , SwaamTech

There is some confusion in your question and I can feel two different aspects of your question:

  1. You just want to check valid credit card numbers?
  2. You want to verify whether a credit card number is valid for charge?

First Part:

If you are concerned with for first part, you can look for Asif's answer.

 

Second Part:

If you are concerned for2nd part, then I don't think so that you can find any such service by which you check validity and availability of a credit card. This part is taken care by payment gateways when you put your credit card for payment.

You need to write a script that checks the entered card number against the Luhn algorithm.

Generally, though, this is frivolous check. Just because the pattern is correct does not mean the card number is valid.

Whilst not perfect, the following will help you get started: http://adrianotto.com/2011/10/better-luhn-formula-validator-for-php/

Ahmed Hisham
من قبل Ahmed Hisham , Marketing Consultant - Web Developer , CPI Group

If you have the pattern of the text or number, the best solution is to use regular expressions. If you don't know how to write them, you will find tons of them over the web for many purposes and patterns.

المزيد من الأسئلة المماثلة

هل تحتاج لمساعدة في كتابة سيرة ذاتية تحتوي على الكلمات الدلالية التي يبحث عنها أصحاب العمل؟