💳Create card

This endpoint allows you to create a new card (virtual or physical) for a customer registered in the KrezyPay system. It ensures the validation of the information provided and checks the uniqueness of the card to avoid duplicates.

Create a new card

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

Headers

Name
Value

Content-Type

application/json

Authorization

Bearer <token>

Body

Name
Type
Description

customer_id

string

The customer_id of the customer provided during registration

card_type

string

The type of card "Virtual" or "Physical"

card_brand

string

The brand of card "Visa" or "Mastercard"

Response


{
    "status": "success",
    "card_id": "6711305d3cc1c6711305d3cc1e",
    "message": "Card created successfully"
}

See Examples Below

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

const requestBody = {
    customer_id: "67112de111f2667112de111f28",
    card_type: "Virtual",
    card_brand: "Mastercard"
};

fetch(endpoint, {
    method: 'POST',
    headers: {
        'Content-Type': 'application/json',
        'Authorization': `Bearer ${bearerToken}`
    },
    body: JSON.stringify(requestBody)
})
.then(response => {
    if (!response.ok) {
        throw new Error('Network response was not ok ' + response.statusText);
    }
    return response.json(); // Parse the JSON from the response
})
.then(data => {
    console.log('Success:', data); // Handle the successful response data
})
.catch(error => {
    console.error('Error:', error); // Handle any errors
});

Don't forget to save your rating's card_id

Last updated