PAN Validator API — Credit Card Number Validation for Developers

Credit Card Number Validation

What Is PAN Validation?

Credit Card Number Validation theory. A Primary Account Number (PAN) is the full numeric string embossed on a payment card typically 13 to 19 digits long. Before a transaction even reaches a payment processor, it is possible to perform a fast, purely mathematical check to determine whether the number is structurally plausible. This check is called the Luhn algorithm — a simple checksum formula standardized in ISO/IEC 7812 that catches the majority of accidental entry errors and malformed numbers in milliseconds, with zero network round-trips to a card scheme.

The PAN Validator API by GLOBUS.studio exposes this validation as a hosted endpoint with an average latency of just 1ms, supporting plain text, JSON, and JSONP response formats to fit any integration pattern.

API Endpoint and Parameters

GET https://api.globus.studio/v2/pan?card_number={PAN}&format={format}

The format parameter accepts three values:

  • json — structured JSON object with card_number and validity fields
  • jsonp — JSONP response wrapped in a callback() function (default callback name)
  • plain — bare string response: valid or invalid

For JSONP responses, a custom callback function name can be specified with the additional &callback=functionName parameter. Full documentation is available on the PAN Validator API page.

Request and Response Examples

JSON Format

GET /v2/pan?card_number=4111111111111111&format=json

{
  "card_number": "4111111111111111",
  "validity": "valid"
}

JSONP with Default Callback

GET /v2/pan?card_number=4111111111111111&format=jsonp

callback({
  "card_number": "4111111111111111",
  "validity": "valid"
});

JSONP with Custom Callback

GET /v2/pan?card_number=4111111111111111&format=jsonp&callback=getCardValidity

getCardValidity({
  "card_number": "4111111111111111",
  "validity": "valid"
});

Plain Text Format

GET /v2/pan?card_number=4111111111111111&format=plain

valid

Invalid Number JSON

GET /v2/pan?card_number=1234567812345670&format=json

{
  "card_number": "1234567812345670",
  "validity": "invalid"
}

Common Use Cases

Real-Time Checkout Form Validation

The most immediate application is inline validation on payment forms. As a user finishes typing their card number, a quick call to the PAN Validator API (Credit Card Number Validation) — or a client-side Luhn check backed by this API for server confirmation — can display a validation indicator before the user submits the form. Catching invalid numbers at this stage eliminates a round-trip to the payment processor and reduces failed transaction rates, which directly impacts checkout conversion.

Batch Validation in Data Pipelines

Data engineering teams working with payment records — migrating databases, auditing stored card tokens, or processing imported datasets from legacy systems — often need to flag structurally invalid PANs before further processing. At 1ms per request, the API can validate thousands of records per second, making it practical as a pipeline stage without becoming a throughput bottleneck.

WooCommerce and E-Commerce Plugin Development

WordPress developers building custom payment gateway plugins for WooCommerce can call the PAN Validator API (Credit Card Number Validation) server-side during the order placement hook to validate card numbers before passing them downstream. This adds a lightweight pre-check that rejects obviously malformed input early, reducing unnecessary API calls to payment processors and keeping error handling cleaner throughout the checkout flow.

Payment Form Testing and QA

When writing automated tests for checkout flows, QA engineers need a reliable way to generate and verify test card numbers. The plain-text format of the PAN Validator API (Credit Card Number Validation) makes it trivially easy to integrate into test scripts: generate a candidate number, POST it to the endpoint, and assert the response equals valid — no JSON parsing required.

Fraud Pre-Screening

A PAN that fails the Luhn check cannot belong to any real card. Rejecting such numbers at the API gateway or middleware layer — before they reach fraud scoring models or manual review queues — keeps those systems focused on plausible cases. It is a trivially cheap filter that improves the signal-to-noise ratio of downstream fraud tooling.

JSONP for Legacy Front-End Integrations

Older front-end codebases and third-party widgets that predate CORS may rely on JSONP for cross-origin data fetching. The PAN Validator API’s native JSONP support — including custom callback names — means it can be integrated into such environments without any server-side proxy or infrastructure changes, keeping legacy systems functional without a full rewrite.

Integration Examples

cURL

curl "https://api.globus.studio/v2/pan?card_number=4111111111111111&format=json"

JavaScript (Fetch API)

const res = await fetch(
  'https://api.globus.studio/v2/pan?card_number=4111111111111111&format=json'
);
const data = await res.json();
console.log(data.validity); // "valid"

PHP

$card = '4111111111111111';
$url  = "https://api.globus.studio/v2/pan?card_number={$card}&format=json";
$data = json_decode(file_get_contents($url), true);
echo $data['validity']; // valid

Python

import requests
data = requests.get(
    'https://api.globus.studio/v2/pan',
    params={'card_number': '4111111111111111', 'format': 'json'}
).json()
print(data['validity'])  # valid

WordPress (PHP)

$card     = '4111111111111111';
$response = wp_remote_get(
    "https://api.globus.studio/v2/pan?card_number={$card}&format=json"
);
$data     = json_decode( wp_remote_retrieve_body( $response ), true );
$validity = $data['validity']; // valid

Important Note on Scope

Luhn validation (Credit Card Number Validation) confirms that a card number is mathematically well-formed — it does not verify that the card exists, is active, has sufficient funds, or belongs to the requesting user. It is a structural integrity check, not an authorization step. For full card verification, the number must be submitted to a payment processor or card scheme through a PCI-compliant integration. The PAN Validator API is designed to complement that process by eliminating invalid numbers before they consume processing resources.

Performance

At 1ms average latency, the PAN Validator API is among the fastest endpoints in the GLOBUS.studio developer toolkit. The response is minimal by design, making it suitable for synchronous inline use — including server-side rendering, real-time form feedback, and high-frequency batch jobs — without any measurable impact on page load or pipeline throughput.

Test the endpoint live and review all supported parameters on the PAN Validator API documentation page.