# Test Card Generator API

> Test Card Generator is a test credit card generator API: it creates card numbers that pass format and Luhn checksum validation, for testing checkout forms and payment UIs across Visa, Mastercard, Amex, Discover, JCB, Diners Club and UnionPay. They aren't real cards: no bank issued them, and they can't be charged or used to buy anything. Each card comes with a security code, expiration date, issuer and masked number, and the gateway option returns Stripe's or Braintree's own documented test cards instead.

**Endpoint:** `GET https://api.apiverve.com/v1/cardgenerator`  
**Category:** Data Generation  
**Cost:** 1 credit per call  
**Canonical page:** https://apiverve.com/marketplace/cardgenerator

## Overview

A credit card generator for testing, with complete details in one call. Pick a brand and get card numbers that pass the Luhn check and the brand's prefix and length rules, each with a security code, a future expiration date in MM/YYYY, an issuer name, and masked, spaced and last-four versions for display. The Free plan returns one card per call; paid plans return up to 50 and add a generated cardholder name and address. To test what your checkout does with a decline, an incorrect CVC or a 3D Secure challenge, set gateway to stripe or braintree with a scenario, and you get that gateway's published test cards, each with the outcome its test mode will produce. To check a number you already have, use Card Validator.

## Authentication

Every call carries your key in an `x-api-key` header. The same key works across the whole
APIVerve catalog — there are no per-API subscriptions. Responses always use the same three
top-level keys: `status`, `error`, and `data`.

## Example request

```bash
curl "https://api.apiverve.com/v1/cardgenerator?brand=visa&count=5&includeAvatar=true&gateway=value&scenario=value" \
  -H "x-api-key: YOUR_API_KEY"
```

## Parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `brand` | string | No | The brand of the card to generate. default visa. One of: visa, mastercard, amex, discover, jcb, diners, unionpay |
| `count` | integer | No | The number of test card numbers to generate. default 1. range 1-50. Premium field |
| `includeAvatar` | boolean | No | Include an AI-generated face avatar for the card owner. default false. Premium field |
| `gateway` | string | No | Return this payment gateway's documented test cards instead of generated numbers. They trigger a known outcome in the gateway's test mode. One of: stripe, braintree |
| `scenario` | string | No | With gateway: the outcome to test, such as success, declined, insufficient_funds, expired_card, incorrect_cvc, fraud or 3ds_required (Stripe). Decline scenarios are mostly Visa cards, so the brand is ignored when the gateway has none for it. default success. One of: success, declined, insufficient_funds, lost_card, stolen_card, expired_card, incorrect_cvc, processing_error, incorrect_number, velocity_exceeded, fraud, 3ds_required |

## Response fields

- `brand` — string · Card brand for generated test cards
- `count` — number · Total number of generated test cards
  - `cards.0.cvv` — number · Card verification value security code
  - `cards.0.issuer` — string · Financial institution that issued the card
  - `cards.0.id` — string · Unique identifier for generated card
  - `cards.0.number` — string · Full test card number for payment testing
  - `cards.0.expiration` — string · Card expiration date in MM/YYYY format
  - `cards.0.brand` — string · Card brand identifier (visa, mastercard, etc)
  - `cards.0.number_alt` — object
    - `cards.0.number_alt.masked` — string · Card number with asterisks masking sensitive digits
    - `cards.0.number_alt.unmasked` — string · Card number formatted with spaces for readability
    - `cards.0.number_alt.last4` — string · Last four digits of card number
- `owner` — object · Cardholder owner information and address details · (premium)
  - `owner.name` — string · Full name of the card owner · (premium)
  - `owner.address` — object · (premium)
    - `owner.address.street` — string · Street address of card owner · (premium)
    - `owner.address.city` — string · City of card owner residence · (premium)
    - `owner.address.state` — string · State of card owner residence · (premium)
    - `owner.address.zipCode` — string · Postal zip code of card owner · (premium)
  - `owner.avatar` — string · URL to AI-generated face avatar image · (premium)

## Sample response

```json
{
  "status": "ok",
  "error": null,
  "data": {
    "brand": "visa",
    "count": 5,
    "cards": [
      {
        "cvv": 175,
        "issuer": "SOUTHEAST F.C.U.",
        "id": "0faca124-9a33-4ac6-a3df-8bf103025779",
        "number": "4750377207233152",
        "expiration": "12/2030",
        "brand": "visa",
        "number_alt": {
          "masked": "************3152",
          "unmasked": "4750 3772 0723 3152",
          "last4": "3152"
        }
      },
      {
        "cvv": 129,
        "issuer": "U.S. BANK, N.A.",
        "id": "0d074efe-69e2-4e30-b49a-4cead1ea8411",
        "number": "4431387818727358",
        "expiration": "12/2030",
        "brand": "visa",
        "number_alt": {
          "masked": "************7358",
          "unmasked": "4431 3878 1872 7358",
          "last4": "7358"
        }
      },
      {
        "cvv": 249,
        "issuer": "AUGUSTA VAH F.C.U.",
        "id": "2f01f458-7422-400e-bbcf-41364564193b",
        "number": "4425919427248836",
        "expiration": "12/2030",
        "brand": "visa",
        "number_alt": {
          "masked": "************8836",
          "unmasked": "4425 9194 2724 8836",
          "last4": "8836"
        }
      },
      {
        "cvv": 892,
        "issuer": "CITIZENS SECURITY BANK AND TRUST COMPANY",
        "id": "d311e9d0-f410-4f75-a21f-f14125c88cbb",
        "number": "4127737519045634",
        "expiration": "12/2030",
        "brand": "visa",
        "number_alt": {
          "masked": "************5634",
          "unmasked": "4127 7375 1904 5634",
          "last4": "5634"
        }
      },
      {
        "cvv": 524,
        "issuer": "CREDIT LIBANAIS S.A.L.",
        "id": "64113f4d-c625-43d2-9d82-04f220c9e26f",
        "number": "4741441509416816",
        "expiration": "12/2030",
        "brand": "visa",
        "number_alt": {
          "masked": "************6816",
          "unmasked": "4741 4415 0941 6816",
          "last4": "6816"
        }
      }
    ],
    "owner": {
      "name": "Benny Swaniawski",
      "address": {
        "street": "007 Nelson Mountains",
        "city": "Margueriteton",
        "state": "Washington",
        "zipCode": "39956-7950"
      },
      "avatar": "https://storage.googleapis.com/apiverve/APIResources/faces/Male/30-40/12345678.jpg?X-Goog-Signature=..."
    }
  }
}
```

## Use cases

- **Checkout UI Validation** — Frontend developers mock form inputs with formatted unmasked card strings and expiration dates to test responsive payment component styling.
- **Payment Form Validation** — QA engineers fill checkout forms with generated numbers to test card formatting, brand detection, and error states in their own UI, without exposing real credentials.
- **Receipt Layout Proofing** — Designers populate order confirmation templates using masked card numbers and card brands to verify invoice rendering across email clients.
- **Form Auto-Formatting QA** — Feed raw card numbers into billing inputs to verify that client-side scripts correctly format spacing and extract the last four digits.

## SDKs

- **npm** — `npm install @apiverve/cardgenerator` (https://www.npmjs.com/package/@apiverve/cardgenerator)
- **PyPI** — `pip install apiverve-cardgenerator` (https://pypi.org/project/apiverve-cardgenerator/)
- **NuGet** — `dotnet add package APIVerve.API.CardGenerator` (https://www.nuget.org/packages/APIVerve.API.CardGenerator)
- **Source** — https://github.com/apiverve/cardgenerator-api

## More

- Full reference: https://docs.apiverve.com/ref/cardgenerator
- Get an API key: https://dashboard.apiverve.com
- Full catalog: https://apiverve.com/marketplace
