Freeze/Unfreeze
Use this endpoint to Freeze or Unfreeze a card
Freeze or Unfreeze a card
POST
https://api.krezypay.com/v1/sandbox/card/card_status
Headers
Name
Value
Content-Type
application/json
Authorization
Bearer <token>
Body
Name
Type
Description
card_id
string
The card identifier
card_status
string
The status of the card. It must be "active" or "inactive".
Response
{
"status": "success",
"message": "This card has been unfrozen successfully"
}
See Examples Below
// Define the endpoint and the token
const endpoint = 'https://api.krezypay.com/v1/sandbox/card/card_status';
const bearerToken = 'your_bearer_token_here'; // Replace this with your actual Bearer token
// Define the request body
const requestBody = {
card_id: "c451ad689f414827abb0b6dc6ea96edb",
card_status: "active"
};
// Send an HTTP POST request
fetch(endpoint, {
method: 'POST', // The request method
headers: {
'Content-Type': 'application/json', // Tell the server the format of the body
'Authorization': `Bearer ${bearerToken}` // Add the Bearer token to the request headers
},
body: JSON.stringify(requestBody) // Convert the body object to a JSON string
})
.then(response => {
// Check if the response status is OK (2xx)
if (!response.ok) {
return response.json().then(errorData => {
throw new Error(`Error: ${errorData.message}`);
});
}
return response.json(); // Parse the JSON response
})
.then(data => {
console.log(JSON.stringify(data, null, 2)); // Log the response as formatted JSON
})
.catch((error) => {
console.error('Error:', error); // Handle any errors during the request
});
Last updated