Withdraw fund

This endpoint allows you to unload a Visa or Mastercard card

Withdraw fund

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

Headers

Name
Value

Content-Type

application/json

Authorization

Bearer <token>

Body

Name
Type
Description

card_id

string

The card identifier

amount

string

The withdrawal amount

Response


{
    "status": "success",
    "transaction_id": "VC383611797554",
    "amount": 3,
    "fees": "0",
    "message": "Transaction completed successfully"
}

See Examples Below

// API URL
const url = "https://api.krezypay.com/v1/sandbox/card/withdraw_fund";

// Data to send in the body of the request
const data = {
  card_id: "c451ad689f414827abb0b6dc6ea96edb",
  amount: "3"
};

// Bearer token
const token = "YOUR_BEARER_TOKEN_HERE";  // Replace with the actual token

// Request options
const options = {
  method: "POST",  // HTTP method
  headers: {
    "Content-Type": "application/json",  // Sending JSON data
    "Authorization": `Bearer ${token}`   // Authorization header with Bearer token
  },
  body: JSON.stringify(data)  // Convert the data object to a JSON string
};

// Execute the HTTP request
fetch(url, options)
  .then(response => {
    if (!response.ok) {
      // If the response status is not OK (200-299), throw an error
      throw new Error(`HTTP error! status: ${response.status}`);
    }
    return response.json();  // Parse the response body as JSON
  })
  .then(result => {
    // Handle success - log the result
    console.log("Success:", result);
  })
  .catch(error => {
    // Handle errors during the request
    console.error("Error:", error);
  });

Last updated