creditcard
A simple class for identifying, validating, and formatting credit card numbers.
Maintained fork of alexforster/creditcard.
Changes: droppedpkg_resourcesdependency (fixes Python 3.12+), modernized packaging topyproject.toml.
Install
pip install pycreditcard
Usage
from creditcard import CreditCard
card = CreditCard('4111111111111111', expire_month='03', expire_year='2030', code='123')
print(card.brand) # Visa
print(card.is_valid) # True
Supported Card Families
Note: pull requests for new cards are welcome!
- Visa
- American Expiress
- Mastercard
- Discover
- Diners Club
- UnionPay (China)
- JCB (Japan Credit Beauro)
Changes from Original
| Version | Change |
|---|---|
| 1.1.0 | Replaced pkg_resources with importlib.resources (Python 3.12+ fix) |
| 1.1.0 | Migrated packaging to pyproject.toml |
Credits
Original library authored by Alex Forster.
Copyright 2017 Alex Forster. All rights reserved.
Licensed under the MIT License.
Metadata
Release files for pycreditcard 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pycreditcard-1.1.0.tar.gz | 4.5 kB | With provenance | Details for pycreditcard-1.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pycreditcard-1.1.0-py3-none-any.whl | Python 3 | none | any | Details for pycreditcard-1.1.0-py3-none-any.whl |
Total release size: 9.6 kB
Release files / pycreditcard-1.1.0.tar.gz
| Download URL | pycreditcard-1.1.0.tar.gz |
|---|---|
| Size | 4.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
acc5815cb7048cee5e23f82308cc533de232ec357f57251302113bc6b259134c
|
|
BLAKE2b-256 checksum How to use checksums |
9b3a1c70357528078f6557488b05942ddc2b09a74093981248717b937296ebba
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 2, 2026.
Transparency logRelease files / pycreditcard-1.1.0-py3-none-any.whl
| Download URL | pycreditcard-1.1.0-py3-none-any.whl |
|---|---|
| Size | 5.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2bc667266893db7f2c130381570c4e120896bf592cbec1e82574fecac96622e7
|
|
BLAKE2b-256 checksum How to use checksums |
889c88e29b7b8795c30763c45f673c5d0b65e4cd4962312d0a8d59a24f210a99
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 2, 2026.
Transparency logSecurity for pycreditcard 1.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for pycreditcard-1.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 2, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.