Thursday, October 28, 2010

Generating a
Valid Credit Card Number

I've been asked to work on a Zen Cart
Website. Zen Cart is something I know
little about.

The first step is to work the shopping
cart with a fake credit card number. How
do you generate a fake number? That was
my question.

Here's a wonderful web page that gives
specific instructions on how to do this:

How To Generate
Valid (Fake) Credit Card Numbers


Here's the steps I followed to do this
based on the above web page:

  1. I registered as a user on the
    Zen Cart site.
  2. I put one item in the shopping
    cart
  3. I made my way to the checkout page
  4. I entered my fake credit card number
    with a fake CVV and a fake date sometime
    in the future

How did I come up with the fake credit card
number? I followed the following steps:

  1. I took out my personal credit card
  2. I looked at the 16 digits that the card
    has (4 sets of 4).
  3. I took the first 6 digits and used them
    to identify a valid card issuer. My card is
    a MasterCard.
  4. I wrote non-sense digits for digits 7-15.
  5. I worked on digit 16 next
  6. I entered digits 0-9 until I hit
    paydirt. When I had successfully entered
    digit 16 I knew it was a correct
    number (fake but valid)

Here are the three essentials you need to
generate a fake credit card number that
Zen Cart will accept:

  1. You need 16 digits as credit cards
    have 16 digits (4 sets of 4)
  2. Digits 1-6 should be digits that you
    get off of an existing credit card so as
    to ensure these digits are valid
  3. Digits 7-15 should be fake but
    consistently fake. Keep digits 7-15
    consistent as these digits will be
    check-sumed
  4. For digit 16, keep on typing a fake
    digit (anything in the range of 0-9) until
    you find that digit that goes with
    your fake digits (digits 7-15).

In other words, you keep all digits consistent
except digit 16. You then experiment with
digit 16 until it matches the other digits.
Since there are only 10 digits in the math
we were taught in school, the maximum number
of digits you will have to try will be 10
digits (worst case scenario is working your way from zero all the way to nine).

Here's one more thing I did: Once I found a
good credit card number, I wrote it down. This
is so that I would not have to go through
this process of discovery a second time.

Note that this probably will not work for
all Zen Cart shopping carts. It worked for
me because the website owner processes her
credit card input by hand.

Undoubtedly, there must be a way to fully
automate Zen Cart with a payment gateway
and all of that. Generating a fake credit
card number for testing purposes in the case
where the credit card information is looked
up in a database is unknown to me. I'm sure
it can be done. I just don't know how.

The Zen Cart I'm working on does not directly
contact the bank. Therefore, generating a fake
will work. Why? Because the bank is not actually
contacted by the shopping cart.

Creating a sandbox on Zen Cart for testing
credit cards is an unknown to me. How this is done
I cannot say.

By sandbox, I mean a way to test things and still
actually contact the bank. Surely there must be
a way to do this.

Since the Zen Cart I'm working on does not actually
contact the bank, contacting the bank for real is
beyond the scope of this article.

My solution is to create my own sandbox for testing
purposes that works well enough for now.

Ed Abbott

No comments:

Post a Comment