Skip to main content

django-credit-cards

A Django app providing database and form fields for credit cards.

Compatibility

  • django >= 1.8
  • python >= 3

Quickstart

Install django-credit-cards:

pip install django-credit-cards

Then add it to your models:

from creditcards.models import CardNumberField, CardExpiryField, SecurityCodeField

class Payment(models.Model):
    cc_number = CardNumberField(_('card number'))
    cc_expiry = CardExpiryField(_('expiration date'))
    cc_code = SecurityCodeField(_('security code'))

Or to your forms:

from creditcards.forms import CardNumberField, CardExpiryField, SecurityCodeField

class PaymentForm(forms.Form):
    cc_number = CardNumberField(label='Card Number')
    cc_expiry = CardExpiryField(label='Expiration Date')
    cc_code = SecurityCodeField(label='CVV/CVC')

Credit Card Type Detection

from creditcards import types

assert types.get_type('4444333322221111') == types.CC_TYPE_VISA
assert types.get_type('343434343434343') == types.CC_TYPE_AMEX
assert types.get_type('0000000000000000') == types.CC_TYPE_GENERIC

License

Copyright (c) 2018 Mihail Mishakin Released under the BSD license (see LICENSE)

Release files for django-credit-cards 0.4.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-credit-cards 0.4.1
File Size Uploaded
django-credit-cards-0.4.1.tar.gz 5.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-credit-cards 0.4.1
File Interpreter ABI Platform
django_credit_cards-0.4.1-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 13.0 kB

Release files / django-credit-cards-0.4.1.tar.gz

Download URL django-credit-cards-0.4.1.tar.gz
Size 5.7 kB
Tags Source
SHA-256 checksum
How to use checksums
e9c51399b718375cbddee18c13559de154c8de1b1cae4ae9e5db29d5df258bff
BLAKE2b-256 checksum
How to use checksums
f4878c1d328b8451d7a7b7abd492c9f093153aba35d957a70eb5b95ad29058b5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.8

Release files / django_credit_cards-0.4.1-py2.py3-none-any.whl

Download URL django_credit_cards-0.4.1-py2.py3-none-any.whl
Size 7.3 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
63f651070d556689d57907d49a5fd6a12df698db303665c0daebdcefc34abe96
BLAKE2b-256 checksum
How to use checksums
a1cfd23dcb1a7631cd0c3339c4be08ccb74feff46137c06e794f9ce70d46375f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.8

Release history Release notifications | RSS feed

This release

0.4.1 This release

2 release files

0.4

1 release file

0.3

2 release files

0.2

2 release files

0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page