Validation Utilities

Validate Credit Card

Validates credit card numbers using the Luhn algorithm checksum to verify mathematical validity. Available via MCP in Cursor and other AI editors, or REST API at `/v1/validate/credit-card`. Pass any card number like `4532015112830366` and get deterministic validation results. Catches typos and invalid sequences but doesn't verify if the card is active or real.

API Endpoint

GET /v1/validate/credit-card

Code Examples

curl "https://tinyfn.io/v1/validate/credit-card" \
  -H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/validate/credit-card', {
  headers: { 'X-API-Key': 'YOUR_API_KEY' }
});
const data = await response.json();
console.log(data);
import requests

response = requests.get('https://tinyfn.io/v1/validate/credit-card',
    headers={'X-API-Key': 'YOUR_API_KEY'})
data = response.json()
print(data)

Use via MCP

Add to your AI agent

Connect your AI agent (Claude, Cursor, Windsurf, etc.) to TinyFn's validation tools:

{
  "mcpServers": {
    "tinyfn-validation": {
      "url": "https://tinyfn.io/mcp/validation",
      "headers": {
        "X-API-Key": "YOUR_API_KEY"
      }
    }
  }
}

Learn more about MCP setup →

FAQ

How does the Luhn algorithm validate credit card numbers?

The Luhn algorithm uses a checksum calculation where digits are doubled in alternating positions, summed with adjustments for two-digit results, and the total must be divisible by 10 to be valid.

Can I use this MCP tool to validate card numbers in my AI coding assistant?

Yes, tools like Cursor and Claude Code can call this validation directly during development, useful for form validation logic or payment processing workflows.

Does this tool verify if a credit card is real or just mathematically valid?

It only checks mathematical validity using Luhn algorithm. A number can pass validation but still be fake, expired, or inactive.

What card types does the Luhn validator support?

Works with all major card types (Visa, MasterCard, American Express, Discover) since Luhn algorithm is universal across card networks.

How do I handle spaces or dashes in credit card numbers?

Strip formatting before validation. The tool expects clean numeric strings like `4532015112830366` rather than `4532-0151-1283-0366`.

Try Validate Credit Card Now

Get your free API key and start using Validate Credit Card in seconds.

Get Free API Key