# braintree/credit-card-type

A library for determining credit card type

Repository: https://github.com/braintree/credit-card-type
Canonical: https://ross.abutalabs.com/products/credit-card-type
Language: TypeScript
License: MIT
License Family: permissive
Topics: js-sdk
Last push: 2026-07-04T23:02:48+00:00

## Health v2 (maintenance only)
Score: 74/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 90, release rhythm 40, longevity 100
- inputs: {"age_days": 4157, "days_push": 60, "days_rel": 490, "gap_med": 0.0, "n_releases_24m": 3}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1038, forks 156 (observed 2026-08-28T04:03:19.711589+00:00)

## What it is
A small JavaScript/TypeScript utility library that identifies credit card brand types from full or partial card numbers, supporting type-as-you-go detection. It is not a validation library but a building block for payment forms and validation UIs.

## Use cases
- detect credit card type from partial number as user types
- show correct card brand icon in a payment form
- identify card brand from a full card number
- build custom credit card validation logic
- handle ambiguous BIN prefixes like UnionPay vs Discover
- normalize card brand codes for CSS class names

## When to choose
- you need lightweight, dependency-free card brand detection in Node or the browser
- you want type-as-you-go detection supporting partial numbers
- you need broad brand coverage including regional cards like Elo, Mir, Troy, Verve

## When to avoid
- you need full card number validation (Luhn, expiry, CVV)
- you need payment processing itself rather than card type detection
- you need server-side BIN database lookups with issuer details

## Facets
- artifact type: library
- maturity: stable
- function: parser, developer-tools
- domain: fintech, web-development, frontend
- platform: browser, cross-platform
- tags: credit-cards, card-detection, payments, typescript, validation-helper, nodejs

## Member repositories
- braintree/credit-card-type (main) score 74

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:03:19.711589+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T07:04:14.591830+00:00, confidence not recorded.
  - readme: https://github.com/braintree/credit-card-type (fetched 2026-08-28T04:03:19.711589+00:00, sha d2841028f91d)
  - registry_npm: https://registry.npmjs.org/credit-card-type (fetched 2026-08-29T13:04:52.519609+00:00, sha da9c0848eabf)
- Data as of 2026-08-30T08:39:29.467469+00:00.
