KrezyPay API
  • 👋Welcome to KrezyPay API
  • Environment
  • Authentification
  • Customer
    • 👨Create a customer
    • 👨Retrieve Customer
  • Card
    • 💳Create card
    • 💳Retrieve Card
    • 💳Fund Card
    • Authorization Transaction
    • Withdraw fund
    • Freeze/Unfreeze
    • Transaction
    • Countries we support
  • Topup
    • ✅Topup Shema
    • ✅Estimate
    • ✅Send
  • SMS
    • 📶SMS Shema
    • 📶Send SMS
    • Supporting country
  • Production Access
  • ❌Errors
    • 📎Error
Powered by GitBook
On this page
  1. Customer

Create a customer

PreviousCustomerNextRetrieve Customer

Last updated 7 months ago

Create a new customer

POST

Headers

Name
Value

Content-Type

application/json

Authorization

Bearer <token>

Body

Name
Type
Description

firstname

string

Name of the user

lastname

string

Age of the user

gender

string

Customer gender 'M' or 'F'

email

string

Customer email

phone

string

Customer phone number

country

string

id_type

string

The type of customer's identity documents: ID_CARD or PASSPORT

id_number

string

The customer's ID number

face_id_image

string

The url of the selfie image of the customer's ID

front_id_image

string

The URL of the front image of the customer's ID document

back_id_image

string

The url of the image of the back of the customer's ID to send if the ID type is ID_CARD

Response


{
    "status": "success",
    "customer_id": "670edb909c4c8670edb909c4ca",
    "message": "Customer successfully registered"
}
{
  "error": "Invalid request"
}

See Examples Below

const url = 'https://api.krezypay.com/v1/sandbox/customer/create_customer';

const data = {
    "firstname": "Jhon",
    "lastname": "doe",
    "email": "jhondoe@gmail.com",
    "phone": "+18293857569",
    "gender": "M",
    "country": "UNITED STATES",
    "id_number": "R11770744",
    "id_type": "ID_CARD",
    "front_id_image": "https://images/document-front-pre_738bbeee-418d-488c-8b52-7d667a6b1f46.png",
    "face_id_image": "https://face_86fe1194-e661-4f2a-9268-7cc1429a86df.png",
    "back_id_image": "https://face_86fe1194-e661-4f2a-9268-7ccg1429a86df.png"
};

// Bearer token
const token = 'your_bearer_token_here';

fetch(url, {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': `Bearer ${token}`
  },
  body: JSON.stringify(data)
})
.then(response => response.json())  // Parse the response as JSON
.then(result => console.log(result)) // Log the JSON result
.catch(error => console.error('Error:', error));
<?php

$url = 'https://api.krezypay.com/v1/sandbox/customer/create_customer';

$data = [
    "firstname" => "Jhon",
    "lastname" => "doe",
    "email" => "jhondoe@gmail.com",
    "phone" => "+18293857569",
    "gender" => "M",
    "country" => "UNITED STATES",
    "id_number" => "R11770744",
    "id_type" => "ID_CARD",
    "front_id_image" => "https://images/document-front-pre_738bbeee-418d-488c-8b52-7d667a6b1f46.png",
    "face_id_image" => "https://face_86fe1194-e661-4f2a-9268-7cc1429a86df.png",
    "back_id_image" => "https://face_86fe1194-e661-4f2a-9268-7ccg1429a86df.png"
];

// Bearer token
$token = 'your_bearer_token_here';

// Initialize cURL session
$ch = curl_init($url);

// Set the options for the cURL session
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Content-Type: application/json',
    'Authorization: Bearer ' . $token
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));

// Execute the request and store the response
$response = curl_exec($ch);

// Check for errors
if (curl_errno($ch)) {
    echo 'cURL error: ' . curl_error($ch);
} else {
    // Parse the response
    $decoded_response = json_decode($response, true);
    if (json_last_error() === JSON_ERROR_NONE) {
        // Output the JSON response
        print_r($decoded_response);
    } else {
        echo 'Error decoding JSON response: ' . json_last_error_msg();
    }
}

// Close the cURL session
curl_close($ch);
?>
import requests
import json

url = 'https://api.krezypay.com/v1/sandbox/customer/create_customer'

data = {
    "firstname": "Jhon",
    "lastname": "doe",
    "email": "jhondoe@gmail.com",
    "phone": "+18293857569",
    "gender": "M",
    "country": "UNITED STATES",
    "id_number": "R11770744",
    "id_type": "ID_CARD",
    "front_id_image": "https://images/document-front-pre_738bbeee-418d-488c-8b52-7d667a6b1f46.png",
    "face_id_image": "https://face_86fe1194-e661-4f2a-9268-7cc1429a86df.png",
    "back_id_image": "https://face_86fe1194-e661-4f2a-9268-7ccg1429a86df.png"
}

# Bearer token
token = 'your_bearer_token_here'

# Headers
headers = {
    'Content-Type': 'application/json',
    'Authorization': f'Bearer {token}'
}

# Sending the POST request
response = requests.post(url, headers=headers, data=json.dumps(data))

# Checking if the request was successful
if response.status_code == 200:
    # Parsing the response as JSON
    result = response.json()
    print("Response:", json.dumps(result, indent=4))
else:
    print(f"Error {response.status_code}: {response.text}")

Don't forget to save your rating's customer_id

Customer's country. Please click to see supported countries.

👨
https://api.krezypay.com/v1/sanbox/customer/create_customer
here