Skip to main content

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

Project description

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)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-credit-cards-0.4.1.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

django_credit_cards-0.4.1-py2.py3-none-any.whl (7.3 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file django-credit-cards-0.4.1.tar.gz.

File metadata

  • Download URL: django-credit-cards-0.4.1.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for django-credit-cards-0.4.1.tar.gz
Algorithm Hash digest
SHA256 e9c51399b718375cbddee18c13559de154c8de1b1cae4ae9e5db29d5df258bff
MD5 d2c892831e348c53b96bcf4ee3ef64e2
BLAKE2b-256 f4878c1d328b8451d7a7b7abd492c9f093153aba35d957a70eb5b95ad29058b5

See more details on using hashes here.

File details

Details for the file django_credit_cards-0.4.1-py2.py3-none-any.whl.

File metadata

  • Download URL: django_credit_cards-0.4.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 7.3 kB
  • Tags: Python 2, Python 3
  • Uploaded using 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

File hashes

Hashes for django_credit_cards-0.4.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 63f651070d556689d57907d49a5fd6a12df698db303665c0daebdcefc34abe96
MD5 a8459a23db071a9d12686bef026d8d92
BLAKE2b-256 a1cfd23dcb1a7631cd0c3339c4be08ccb74feff46137c06e794f9ce70d46375f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page