Skip to content

Instantly share code, notes, and snippets.

@mjallday
Created September 18, 2012 18:31
Show Gist options
  • Save mjallday/3744893 to your computer and use it in GitHub Desktop.
Save mjallday/3744893 to your computer and use it in GitHub Desktop.
Card tokenization verification
import balanced
key = balanced.APIKey().save()
balanced.configure(key.secret)
balanced.Marketplace().save()
three_digit_cards = [
5610591081018250,
6011111111111117,
6011000990139424,
3530111333300000,
3566002020360505,
5555555555554444,
5105105105105100,
4111111111111111,
4012888888881881,
]
four_digit_cards = [
378282246310005,
371449635398431,
378734493671000,
]
def try_card(card_number, security_code):
try:
balanced.Card(
expiration_month=12,
expiration_year=2012,
card_number=card_number,
security_code=security_code,
).save()
except balanced.exc.HTTPError as ex:
print card, ex
for card in three_digit_cards:
try_card(card, '123')
for card in four_digit_cards:
try_card(card, '1234')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment