0

Get the complete data associated with a debit/credit card

by
Published Apr 8, 2025

Utilize this module to effortlessly retrieve comprehensive information associated with a debit or credit card. The API provides details such as card type (debit or credit), scheme (Visa, Mastercard, etc.), brand (gold, platinum, etc.), and bank information. This data is invaluable for various applications, including verifying customer payment details, detecting fraudulent transactions, and delivering personalized services to enhance user experiences.

Script greip Verified

The script

Submitted by hugo697 Bun
Verified 428 days ago
1
//native
2
type Greip = {
3
  apiKey: string;
4
};
5
/**
6
 * Get the complete data associated with a debit/credit card
7
 * Utilize this module to effortlessly retrieve comprehensive information associated with a debit or credit card.
8

9
The API provides details such as card type (debit or credit), scheme (Visa, Mastercard, etc.), brand (gold, platinum, etc.), and bank information.
10

11
This data is invaluable for various applications, including verifying customer payment details, detecting fraudulent transactions, and delivering personalized services to enhance user experiences.
12
 */
13
export async function main(
14
  auth: Greip,
15
  bin: string,
16
  format: string | undefined,
17
  userID: string | undefined,
18
  mode: string | undefined,
19
  callback: string | undefined,
20
) {
21
  const url = new URL(`https://greipapi.com/lookup/bin`);
22
  for (const [k, v] of [
23
    ["bin", bin],
24
    ["format", format],
25
    ["userID", userID],
26
    ["mode", mode],
27
    ["callback", callback],
28
  ]) {
29
    if (v !== undefined && v !== "" && k !== undefined) {
30
      url.searchParams.append(k, v);
31
    }
32
  }
33
  const response = await fetch(url, {
34
    method: "GET",
35
    headers: {
36
      Authorization: "Bearer " + auth.apiKey,
37
    },
38
    body: undefined,
39
  });
40
  if (!response.ok) {
41
    const text = await response.text();
42
    throw new Error(`${response.status} ${text}`);
43
  }
44
  return await response.text();
45
}
46