Transaction
Retrieve transactions on a card
GET
https://api.krezypay.com/v1/sandbox/card/card_transaction?card_id=c451ad689f414827abb0b6dc6ea96edb
This endpoint allows you to retrieve transactions on a Visa or Mastercard card
Headers
Name | Value |
---|---|
Content-Type |
|
Authorization |
|
Body
Name | Type | Description |
---|---|---|
card_id | string | The card identifier |
Response
{
"status": "success",
"transactions": [
{
"reference": "b0f6c1d480ca4a3d93c83cca7e9a9b55",
"amount": "+4.03",
"date": "2024-10-21 07:23:29",
"merchant": "AUTHORIZATION",
"website": "None",
"logo": "https://logos.ntropy.com/consumer_icons-ATM_bank_deposit",
"description": "Mastercard Virtual dollar card funding"
},
{
"reference": "a25cde08cff04e4ebef6bf2583150999",
"amount": "+2.00",
"date": "2024-10-21 07:18:04",
"merchant": "AUTHORIZATION",
"website": "None",
"logo": "https://logos.ntropy.com/consumer_icons-ATM_bank_deposit",
"description": "Mastercard Virtual dollar card funding"
},
{
"reference": "08e42cdc02d141ebbf7c4ef5ed3916b8",
"amount": "+10.00",
"date": "2024-10-21 06:22:24",
"merchant": "AUTHORIZATION",
"website": "None",
"logo": "https://logos.ntropy.com/consumer_icons-ATM_bank_deposit",
"description": "Mastercard Virtual dollar card funding"
},
{
"reference": "eb0162321322450196b7e931169f5f52",
"amount": "+2.00",
"date": "2024-10-20 14:32:24",
"merchant": "AUTHORIZATION",
"website": "None",
"logo": "https://logos.ntropy.com/consumer_icons-ATM_bank_deposit",
"description": "Mastercard Virtual dollar card funding"
}
]
}
{
"error": "Invalid request"
}
See Examples Below
const cardId = 'c451ad689f414827abb0b6dc6ea96edb'; // Replace with your card ID
const bearerToken = 'YOUR_BEARER_TOKEN'; // Replace with your Bearer token
const url = `https://api.krezypay.com/v1/sandbox/card/card_transaction?card_id=${cardId}`;
fetch(url, {
method: 'GET',
headers: {
'Authorization': `Bearer ${bearerToken}`,
'Content-Type': 'application/json'
}
})
.then(response => {
// Check if the response is okay (status in the range 200-299)
if (!response.ok) {
throw new Error(`HTTP error! Status: ${response.status}`);
}
return response.json(); // Parse the JSON from the response
})
.then(data => {
console.log('Success:', data); // Log the successful response data
})
.catch(error => {
console.error('Error:', error); // Log any errors that occurred
});
<?php
$cardId = 'c451ad689f414827abb0b6dc6ea96edb'; // Replace with your card ID
$bearerToken = 'YOUR_BEARER_TOKEN'; // Replace with your Bearer token
$url = "https://api.krezypay.com/v1/sandbox/card/card_transaction?card_id=" . $cardId;
// Initialize a cURL session
$ch = curl_init($url);
// Set the request method to GET
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
// Set the headers
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Authorization: Bearer " . $bearerToken,
"Content-Type: application/json"
]);
// Return the response instead of printing it
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// Execute the request
$response = curl_exec($ch);
// Check for errors
if (curl_errno($ch)) {
echo json_encode(["status" => "error", "message" => curl_error($ch)]);
} else {
// Decode the response
$data = json_decode($response, true);
// Print the response data
echo json_encode(["status" => "success", "data" => $data]);
}
// Close the cURL session
curl_close($ch);
?>
import requests
# Replace with your card ID and Bearer token
card_id = 'c451ad689f414827abb0b6dc6ea96edb'
bearer_token = 'YOUR_BEARER_TOKEN'
# Construct the URL
url = f'https://api.krezypay.com/v1/sandbox/card/card_transaction?card_id={card_id}'
# Set up the headers
headers = {
'Authorization': f'Bearer {bearer_token}',
'Content-Type': 'application/json'
}
# Send the GET request
response = requests.get(url, headers=headers)
# Check if the request was successful
if response.status_code == 200:
# Parse the JSON response
data = response.json()
print("Success:", data)
else:
# Handle errors
print("Error:", response.status_code, response.text)
Last updated