0

I need to find out what credit card type was used when someone purchased something from my website.

Is it possible to find this out? I was looking through the database tables and couldn't find anything in there. I also looked in the orders payment tab and still couldn't find anything.

Thanks

6
  • Credit card info can be found out by the first two digits (out of 16) on the CC. That will itself tell you whether its AMMEX, MASTERCARD, VISA or else
    – Minty
    Commented Aug 6, 2012 at 23:56
  • As I said, there's nothing in the database related to credit card details. Commented Aug 7, 2012 at 9:10
  • Commerce payment getways must not store the credit card number. If they implemented via redirects drupal commerce never sees the credit card number. If the credit card information is collected by drupal, most payment getway companies will refuse to validate your site if they suspect that you are storing credit card numbers.
    – BetaRide
    Commented Aug 7, 2012 at 11:14
  • Just extract the first 2 digits from the form submission.
    – Minty
    Commented Aug 7, 2012 at 12:35
  • I'm working on a sales by credit card report. My thinking is to take the credit card number as it's submitted, use commerce_payment_validate_credit_card_type() to find the type, then attach it to the transaction entity. It's a work in progress. I'll let you know how it goes.
    – ponies
    Commented Dec 13, 2012 at 0:50

2 Answers 2

2

Drupal commerce does not provide anything for this. Actually it must not do it since payment companies require (and often make it completely impossible) to know the credit card properties.

Your only hope is what might be stored in the commerce_payment_transaction table by the payment gateway. Often, additional data is stored as a serialized PHP object in the payload field.

If you don't find anything there, you might have to dive into the specification of the payment gateway company and check whether they provide this information via the API. If you are lucky this might be integrated into the appropriate commerce payment gateway.

1
  • The commerce_payment_transaction table is the easiest way if your payment gateway includes that data. If it does not, I think the best way is to determine the CC type at the time of payment based on the CC number.
    – Ali Gangji
    Commented Jul 2, 2014 at 20:13
0

The accepted answer is incorrect. Commerce Payment's credit card functions to identify the type of card (for the vast majority of common card types) in commerce_payment_validate_credit_card_type().

This information is not stored by default but it allows you to identify card types for unsuccessful transactions where your gateway doesn't analyze the card number, or during payment validation, for instance.

You still must be PCI compliant with regards the card number, but the card type as indicated by this function is not protected information.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.