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

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 filed.

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

  • 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 Jul 2 '14 at 20:13
1

I'm working on a sales by credit card report.

My thinking is to take the cc 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.

  • 1
    Belated follow up. This worked like a charm for us. – ponies Nov 8 '16 at 16:40
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 the commerce_payment_validate_credit_card_type() function. This information is not stored by default but it would allow you to identify card types for unsuccessful transactions where your gateway does not 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.

  • Please don't add comments as answers. If this is meant as comment, earn enough reputation and post it as a comment. If it is meant as answer, write it in a way that will stay valid even if answer you are referring to will be deleted (or unaccepted). – Mołot Jan 10 '15 at 23:02
  • @Mołot, it is not a comment. It is an additional answer pointing to the commerce_payment_validate_credit_card_type()-function. – Free Radical Jan 11 '15 at 4:14
-1

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

  • As I said, there's nothing in the database related to credit card details. – Marius Ilie Aug 7 '12 at 9:10
  • and please don't post answers just to be the first one. you can add a comment if you're unsure. now my acceptance rate is lower because I can't accept this answer :( – Marius Ilie Aug 7 '12 at 9:14
  • 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 Aug 7 '12 at 11:14
  • @Marius Ilie, yo ! what are you so angry about? The answer lies in extracting the first 2 digits from the form submission. When your client submits the form you have to extract that information. Its that simple. I gave you the hint now implement it yourself buddy. – Minty Aug 7 '12 at 12:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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