💳Fund Card

You can use this endpoint to fund a card.

Fund a card

POST https://api.krezypay.com/v1/sandbox/card/add_fund

Headers

Name
Value

Content-Type

application/json

Authorization

Bearer <token>

Body

Name
Type
Description

card_id

string

The card identifier

amount

string

The amount of the recharge

Response


{
    "status": "success",
    "transaction_id": "KR413225538667",
    "amount": 10,
    "fees": "0.20",
    "message": "Transaction completed successfully."
}

See Examples Below

// Define the endpoint URL
const endpoint = 'https://api.krezypay.com/v1/sandbox/card/add_fund';

// Create the request body
const requestBody = {
    card_id: 'c451ad689f414827abb0b6dc6ea96edb',
    amount: '10'
};

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

// Make the POST request using fetch
fetch(endpoint, {
    method: 'POST', // Specify the request method
    headers: {
        'Content-Type': 'application/json', // Set content type to JSON
        'Authorization': `Bearer ${bearerToken}` // Add bearer token to the Authorization header
    },
    body: JSON.stringify(requestBody) // Convert the request body to a JSON string
})
.then(response => {
    // Check if the response is ok (status code in the range 200-299)
    if (!response.ok) {
        throw new Error('Network response was not ok: ' + response.statusText);
    }
    return response.json(); // Parse the JSON from the response
})
.then(data => {
    // Handle the response data
    console.log('Response:', data);
})
.catch(error => {
    // Handle any errors
    console.error('Error:', error);
});

Last updated