KrezyPay API
  • 👋Welcome to KrezyPay API
  • Environment
  • Authentification
  • Customer
    • 👨Create a customer
    • 👨Retrieve Customer
  • Card
    • 💳Create card
    • 💳Retrieve Card
    • 💳Fund Card
    • Authorization Transaction
    • Withdraw fund
    • Freeze/Unfreeze
    • Transaction
    • Countries we support
  • Topup
    • ✅Topup Shema
    • ✅Estimate
    • ✅Send
  • SMS
    • 📶SMS Shema
    • 📶Send SMS
    • Supporting country
  • Production Access
  • ❌Errors
    • 📎Error
Powered by GitBook
On this page
  • Retrieve a card
  • Recovering sensitive card data
  • Create a new user
  1. Card

Retrieve Card

PreviousCreate cardNextFund Card

Last updated 7 months ago

This endpoint allows to retrieve information of a card associated with a customer registered in the KrezyPay system. It provides details about the card, including its status, type and brand.

Retrieve a card

POST

Headers

Name
Value

Content-Type

application/json

Authorization

Bearer <token>

Body

Name
Type
Description

card_id

string

The card identifier

Response


{
    "status": "success",
    "card_status": "active",
    "card_holder": "Antoine Jeff",
    "card_number": "5323 **** **** 217 ",
    "cvv": "***",
    "last4": "9217",
    "exp": "10/28",
    "balance": "0.00",
    "authorization_balance": "2.00",
    "address": {
        "country": "United States",
        "state": "California",
        "city": "San Francisco",
        "zip_code": "94105",
        "line1": "1088 Roosevelt Street"
    }
}

{
  "error": "Invalid request"
}

See Examples Below

const endpoint = 'https://api.krezypay.com/v1/sandbox/card/retrieve_card';
const bearerToken = 'YOUR_BEARER_TOKEN'; // Replace with your actual bearer token

// Request body data
const requestBody = {
    card_id: 'c451ad689f414827abb0b6dc6ea96edb'
};

// Make the POST request
fetch(endpoint, {
    method: 'POST',
    headers: {
        'Content-Type': 'application/json',
        'Authorization': `Bearer ${bearerToken}` // Set the Authorization header with Bearer token
    },
    body: JSON.stringify(requestBody) // Convert the request body to JSON string
})
.then(response => {
    if (!response.ok) {
        throw new Error(`HTTP error! Status: ${response.status}`);
    }
    return response.json(); // Parse the response as JSON
})
.then(data => {
    console.log('Response:', data); // Handle the response data
})
.catch(error => {
    console.error('Error:', error.message); // Handle errors
});
<?php
// Set the endpoint URL
$endpoint = 'https://api.krezypay.com/v1/sandbox/card/retrieve_card';

// Create the request body
$requestBody = [
    'card_id' => 'c451ad689f414827abb0b6dc6ea96edb'
];

// Convert the request body to JSON format
$jsonBody = json_encode($requestBody);

// Set your bearer token
$bearerToken = 'YOUR_BEARER_TOKEN'; // Replace with your actual bearer token

// Initialize cURL
$ch = curl_init($endpoint);

// Set cURL options
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // Return the response as a string
curl_setopt($ch, CURLOPT_POST, true); // Specify that this is a POST request
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Content-Type: application/json', // Set content type to JSON
    'Authorization: Bearer ' . $bearerToken // Add bearer token to the Authorization header
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonBody); // Attach the request body

// Execute the request
$response = curl_exec($ch);

// Check for errors
if (curl_errno($ch)) {
    echo 'Error: ' . curl_error($ch);
} else {
    // Decode the response
    $responseData = json_decode($response, true);
    
    // Output the response data
    echo 'Response: ';
    print_r($responseData);
}

// Close cURL
curl_close($ch);
?>
import requests

# Set the API endpoint
endpoint = 'https://api.krezypay.com/v1/sandbox/card/retrieve_card'

# Your Bearer token
bearer_token = 'YOUR_BEARER_TOKEN'  # Replace with your actual bearer token

# Request body data
request_body = {
    'card_id': 'c451ad689f414827abb0b6dc6ea96edb'
}

# Set the headers
headers = {
    'Content-Type': 'application/json',
    'Authorization': f'Bearer {bearer_token}'  # Set the Authorization header with Bearer token
}

# Make the POST request
response = requests.post(endpoint, json=request_body, headers=headers)

# Check if the request was successful
if response.status_code == 200:
    # Print the response data
    print('Response:', response.json())
else:
    # Print the error response
    print(f'Error: {response.status_code}, Message: {response.text}')

Recovering sensitive card data


Sensitive Card Data Retrieval API

This API allows for the retrieval of sensitive information related to a bank card after proper authentication and validation. These details are essential for ensuring smooth financial operations while maintaining the highest level of security.

Retrieved Information:

  • Card Status: Indicates whether the card is active, suspended, or expired.

  • Cardholder Name: The full name of the cardholder.

  • Card Number: The full card number or just the last four digits.

  • CVV: The security code found on the back of the card.

  • Expiration Date: The date when the card expires.

  • Balance: The current available balance on the card.

  • Authorization Balance: Amount reserved for pending authorizations.

  • Billing Address: Includes country, state, city, postal code, and address line.

Secure Access: Access to these sensitive details is strictly limited to authenticated users with a valid JWT token. This token is verified with each request to ensure user identity and transaction security.

Security Requirements: All data is transmitted over secure channels (HTTPS) and protected using industry-standard cryptographic measures, including PCI-DSS compliance. Information such as the card number and CVV are never stored in plain text and are only accessible for real-time transactions.

API Usage: To use this API, the user must provide:

  • A valid JWT token via the Authorization header.

  • The card identifier (card_id) to retrieve in the request.

Once the request is validated, the API returns a JSON containing the sensitive card information. If the card is not found or the token has expired, the API returns an error with an appropriate message.

Error Handling:

  • If the JWT token is invalid or expired, a response with HTTP status code 401 is returned.

  • If the card is not found, a response with HTTP status code 404 is returned.

  • If an error occurs while retrieving the data, a response with HTTP status code 422 is returned.

Create a new user

<Description of the endpoint>

Headers

Name
Value

Content-Type

application/json

Authorization

Bearer <token>

Body

Name
Type
Description

card_id

string

The card identifier

Response


{
    "status": "success",
    "card_status": "active",
    "card_holder": "Antoine Jeff",
    "card_number": "5323 8989 2202 9217 ",
    "cvv": "858",
    "last4": "9217",
    "exp": "10/28",
    "balance": "0.00",
    "authorization_balance": "1.00",
    "address": {
        "country": "United States",
        "state": "California",
        "city": "San Francisco",
        "zip_code": "94105",
        "line1": "1088 Roosevelt Street"
    }
}
{
  "error": "Invalid request"
}

See Examples Below

const endpoint = 'https://api.krezypay.com/v1/sandbox/card/retrieve_card_details';
const bearerToken = 'YOUR_BEARER_TOKEN'; // Replace with your actual bearer token

// Request body data
const requestBody = {
    card_id: 'c451ad689f414827abb0b6dc6ea96edb'
};

// Make the POST request
fetch(endpoint, {
    method: 'POST',
    headers: {
        'Content-Type': 'application/json',
        'Authorization': `Bearer ${bearerToken}` // Set the Authorization header with Bearer token
    },
    body: JSON.stringify(requestBody) // Convert the request body to JSON string
})
.then(response => {
    if (!response.ok) {
        throw new Error(`HTTP error! Status: ${response.status}`);
    }
    return response.json(); // Parse the response as JSON
})
.then(data => {
    console.log('Response:', data); // Handle the response data
})
.catch(error => {
    console.error('Error:', error.message); // Handle errors
});
<?php
// Set the endpoint URL
$endpoint = 'https://api.krezypay.com/v1/sandbox/card/retrieve_card_details';

// Create the request body
$requestBody = [
    'card_id' => 'c451ad689f414827abb0b6dc6ea96edb'
];

// Convert the request body to JSON format
$jsonBody = json_encode($requestBody);

// Set your bearer token
$bearerToken = 'YOUR_BEARER_TOKEN'; // Replace with your actual bearer token

// Initialize cURL
$ch = curl_init($endpoint);

// Set cURL options
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // Return the response as a string
curl_setopt($ch, CURLOPT_POST, true); // Specify that this is a POST request
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Content-Type: application/json', // Set content type to JSON
    'Authorization: Bearer ' . $bearerToken // Add bearer token to the Authorization header
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonBody); // Attach the request body

// Execute the request
$response = curl_exec($ch);

// Check for errors
if (curl_errno($ch)) {
    echo 'Error: ' . curl_error($ch);
} else {
    // Decode the response
    $responseData = json_decode($response, true);
    
    // Output the response data
    echo 'Response: ';
    print_r($responseData);
}

// Close cURL
curl_close($ch);
?>
import requests

# Set the API endpoint
endpoint = 'https://api.krezypay.com/v1/sandbox/card/create_card_details'

# Your Bearer token
bearer_token = 'YOUR_BEARER_TOKEN'  # Replace with your actual bearer token

# Request body data
request_body = {
    'customer_id': '67112de111f2667112de111f28',
    'card_type': 'Virtual',
    'card_brand': 'Mastercard'
}

# Set the headers
headers = {
    'Content-Type': 'application/json',
    'Authorization': f'Bearer {bearer_token}'  # Set the Authorization header with Bearer token
}

# Make the POST request
response = requests.post(endpoint, json=request_body, headers=headers)

# Check if the request was successful
if response.status_code == 200:
    # Print the response data
    print('Response:', response.json())
else:
    # Print the error response
    print(f'Error: {response.status_code}, Message: {response.text}')

The card data is extremely sensitive and must be handled securely. Please ensure that all precautions are taken to protect this information.

POST

💳
https://api.krezypay.com/v1/sandbox/card/retrieve_card
https://api.krezypay.com/v1/sandbox/card/retrieve_card_details