# Bulk Card Number Validator (Luhn), Offline (`comall-agency/card-number-validator`) Actor

Check card numbers against the Luhn checksum and detect the network (Visa, Mastercard, Amex, Discover, Diners, JCB) from the prefix. 100% offline: the number stays in memory and never reaches the output or the logs, only a masked form. Checksum only, not an authorization.

- **URL**: https://apify.com/comall-agency/card-number-validator.md
- **Developed by:** [Comall Agency](https://apify.com/comall-agency) (community)
- **Categories:** Developer tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$4.00 / 1,000 card number checkeds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## Card Number Validator (Luhn) — 100% Offline

Catch a mistyped card number before it becomes a failed charge. This Actor
runs the Luhn checksum over a batch of card numbers and identifies the
likely card network from the number pattern.

**100% offline: no external call, and the number itself never leaves the
run.** The full number is used in memory for the one checksum computation
and is never written to the output, the dataset or the logs — only a masked
form (first six digits, last four, PCI-style display masking) is ever
returned.

### What it does

For each number you send, it:

1. Strips spaces and dashes, then checks the result is 8 to 19 digits.
2. Runs the **Luhn checksum** (the standard mod-10 algorithm used by
   essentially every card issuer to catch single-digit typos and most
   digit transpositions).
3. Detects the **network** from the prefix and length: Visa, Mastercard,
   American Express, Discover, Diners Club, JCB.
4. Returns a verdict: `valid`, `invalid_luhn`, `invalid_format`, or
   `unknown_network` (checksum passes but the prefix matches no known
   network).

### Use cases

- **Checkout forms** — an independent server-side double-check before you
  send a charge to your payment processor and pay for a declined attempt.
- **Support and ops tooling** — bulk-verify numbers pulled from a ticket or
  a spreadsheet without pasting them into a random website.
- **Test-data hygiene** — confirm your test card numbers are well-formed
  and map to the network you think they do.

### Input

```json
{ "numbers": ["4111111111111111", "5500 0055 5555 5559", "3714-496353-98431"] }
```

Spaces and dashes are ignored, so you can paste numbers in whatever shape
your source system produced them.

### Output (one row per number)

```json
{
  "input_masked": "411111******1111",
  "valid_format": true,
  "valid_luhn": true,
  "network": "Visa",
  "length": 16,
  "verdict": "valid",
  "checked_at": "2026-08-28T17:00:00.000Z"
}
```

Note what is **not** in that output: the number you sent.

### Pricing

Pay-per-event: **$0.004 per card number checked**, charged once a completed
check is produced, whatever the verdict.

### Limitations — read this before you buy

Format and checksum validation only.

- It does **not** tell you whether the card is active, funded, or reported
  stolen. Only the issuer can answer that, and only through a real
  authorization.
- A `valid` verdict means "this number is well-formed and passes Luhn",
  which is exactly what you want in a form-validation step and nothing more.
- Network detection follows publicly documented prefix ranges; a card from
  a network outside the six listed returns `unknown_network` rather than a
  guess.

### Privacy

Use test numbers whenever you can. If you do send real numbers, the run's
own dataset stores only the masked form shown above — but the values you
type still travel to the platform as run input, so treat this like any
other tool you paste sensitive data into.

### FAQ

**Why is my valid card reported `unknown_network`?**
The checksum passed but the prefix is outside the six networks recognised
here. The number is still well-formed.

### Related Actors

Part of the same family of small, single-purpose checkers on this account —
each does one thing, priced per item checked:

- [IBAN Validator & Formatter](https://apify.com/comall-agency/iban-validator-formatter) — ISO 13616 length + mod-97 checksum, fully offline.
- [Barcode Check-Digit Validator](https://apify.com/comall-agency/barcode-checkdigit-validator) — EAN-13, EAN-8 and UPC-A check digits.
- [EU VAT Number Checker](https://apify.com/comall-agency/eu-vat-checker) — official VIES lookup.
- [Email Address Validator](https://apify.com/comall-agency/email-address-validator) — syntax, domain and MX checks.
- [Password Strength Checker](https://apify.com/comall-agency/password-strength-checker) — entropy scoring, never returns the password.
- [Cron Expression Validator](https://apify.com/comall-agency/cron-expression-tool) — plain-English description and next run times.

# Actor input Schema

## `numbers` (type: `array`):

List of card numbers to check (spaces/dashes ignored). Test numbers only — this actor never stores input.

## Actor input object example

```json
{
  "numbers": [
    "4111111111111111",
    "5500005555555559",
    "371449635398431"
  ]
}
```

# Actor output Schema

## `results` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "numbers": [
        "4111111111111111",
        "5500005555555559",
        "371449635398431"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("comall-agency/card-number-validator").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "numbers": [
        "4111111111111111",
        "5500005555555559",
        "371449635398431",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("comall-agency/card-number-validator").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "numbers": [
    "4111111111111111",
    "5500005555555559",
    "371449635398431"
  ]
}' |
apify call comall-agency/card-number-validator --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,comall-agency/card-number-validator"
        }
    }
}

```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/cDuN4f11CbepKbOkj/builds/nrDV7kaztdVX7sk7u/openapi.json
