# Credit Card API
> A fast, fully-local payment-card toolkit: validate card numbers with the Luhn (mod-10) checksum, detect the brand by IIN/prefix (Visa, Mastercard including the 2-series, American Express, Discover, Diners, JCB, UnionPay, Maestro), format and mask numbers with brand-correct grouping, list supported brands with their valid lengths and CVV length, and generate synthetic Luhn-valid TEST card numbers for QA. Pure server-side compute, no third-party upstream, and inputs are never logged. It is algorithmic only (no real issuer/bank BIN-database lookup). Ideal for checkout forms, payment flows, fraud pre-checks and test fixtures.

## Authentication
All requests require your oanor API key in the `x-oanor-key` header. Get one at https://www.oanor.com/developer/keys.

```bash
curl -H "x-oanor-key: oanor_live_…" "https://api.oanor.com/creditcard-api/..."
```

## Pricing
- **Free** (Free) — 5,000 calls/Mo, 2 req/s
- **Basic** ($7/Mo) — 100,000 calls/Mo, 12 req/s
- **Pro** ($24/Mo) — 700,000 calls/Mo, 40 req/s
- **Mega** ($69/Mo) — 4,000,000 calls/Mo, 150 req/s

## Endpoints

### Card

#### `GET /v1/brands` — List supported brands

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/creditcard-api/v1/brands"
```

**Response:**
```json
{
    "data": {
        "brands": [
            {
                "brand": "amex",
                "lengths": [
                    15
                ],
                "cvv_length": 4
            },
            {
                "brand": "diners",
                "lengths": [
                    14,
                    16,
                    19
                ],
                "cvv_length": 3
            },
            {
                "brand": "jcb",
                "lengths": [
                    16,
                    17,
                    18,
                    19
                ],
                "cvv_length": 3
            },
            {
                "brand": "discover",
                "lengths": [
                    16,
                    17,
                    18,
                    19
                ],
                "cvv_length": 3
            },
            {
                "brand": "unionpay",
                "lengths": [
                    16,
                    17,
                    18,
                    19
                ],
                "cvv_length": 3
            },
            {
                "brand": "mastercard",
                "lengths": [
                    16
                ],
                "cvv_length": 3
            },
            {
                "brand": "maestro",
                "lengths": [
                    12,
                    13,
                    14,
                    15,
                    
…(truncated, see openapi.json for full schema)
```

#### `GET /v1/format` — Format a card number

**Parameters:**
- `number` (query, required, string) — Card number Example: `378282246310005`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/creditcard-api/v1/format?number=378282246310005"
```

**Response:**
```json
{
    "data": {
        "brand": "amex",
        "masked": "378282*****0005",
        "formatted": "3782 822463 10005"
    },
    "meta": {
        "timestamp": "2026-05-30T09:00:24.816Z",
        "request_id": "2217da31-78b1-444b-98cc-62214fb0bbbd"
    },
    "status": "ok",
    "message": "Card formatted",
    "success": true
}
```

#### `GET /v1/generate` — Generate Luhn-valid TEST numbers

**Parameters:**
- `brand` (query, optional, string) — visa, mastercard, amex, discover, diners, jcb, unionpay, maestro Example: `visa`
- `count` (query, optional, string) — How many 1-50 Example: `1`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/creditcard-api/v1/generate?brand=visa&count=1"
```

**Response:**
```json
{
    "data": {
        "note": "Synthetic Luhn-valid test numbers for QA only — not real accounts.",
        "brand": "visa",
        "cards": [
            {
                "number": "4590132852799427",
                "formatted": "4590 1328 5279 9427"
            }
        ],
        "count": 1,
        "length": 16
    },
    "meta": {
        "timestamp": "2026-05-30T09:00:24.887Z",
        "request_id": "39ffb992-7f1d-4a5f-98fb-037c8ebf475a"
    },
    "status": "ok",
    "message": "Test cards generated",
    "success": true
}
```

#### `GET /v1/validate` — Validate a card number

**Parameters:**
- `number` (query, required, string) — Card number (spaces/dashes ok) Example: `4111111111111111`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/creditcard-api/v1/validate?number=4111111111111111"
```

**Response:**
```json
{
    "data": {
        "brand": "visa",
        "valid": true,
        "length": 16,
        "formatted": "4111 1111 1111 1111",
        "cvv_length": 3,
        "luhn_valid": true,
        "length_valid": true,
        "number_masked": "411111******1111"
    },
    "meta": {
        "timestamp": "2026-05-30T09:00:24.956Z",
        "request_id": "5ca0940a-7df7-4ee7-bae8-4c0ef88cbde4"
    },
    "status": "ok",
    "message": "Card validated",
    "success": true
}
```


---
Marketplace page: https://www.oanor.com/api/creditcard-api
OpenAPI spec: https://www.oanor.com/api/creditcard-api/openapi.json
