Customers
Create view and mangage customer information including transactions
Creating a customer
Make a POST request to /api/v3/client endpoint to create a customer. Sample request using axios:
jsconst response = await axios.post(
"/api/v3/clients",
{
business_name: "Tech Solutions Inc.", // The customer's business name. You can use this to represent the customer's name
business_address: "123 Tech Street, Silicon Valley, CA", // The customer's business address. You can use this to represent the customer's address
business_phone: "+1-800-555-0199", // The customer's business phone number. You can use this to represent the customer's phone number
business_email: "[email protected]", // The customer's business email. You can use this to represent the customer's email
category_id: "CAT-456", // The category the customer belongs to
first_name: "John", // (Optional) The first name of the contact person
last_name: "Doe", // (Optional) The last name of the contact person
phone_number: "+1-800-555-0100", // (Optional) The phone number of the contact person
},
{
headers: {
accept: "application/json",
authorization: "Bearer <API-KEY>",
"content-type": "application/json",
},
},
);
Here is an example response received after successfully creating a customer:
json{
"id": 154184,
"owner_id": 1,
"business_id": 1,
"first_name": "Evans",
"last_name": "Atompoya",
"phone_number": "0554221525",
"business_name": "Echis Viper",
"business_address": "happy family, kumasi",
"business_phone": "0554221525",
"business_location": "",
"business_email": "[email protected]",
"created_at": "2024-11-04T16:13:37.000000Z",
"updated_at": "2024-11-04T16:13:37.000000Z",
"account_id": 1080946,
"category": "Class of 2021",
"category_id": 1224,
"deposit_amount": 0,
"deposit_account_id": null,
"archived": false,
"transactions": [],
"unformated_balance": 0,
"balance": "0.00",
"total_debit": "0.00",
"total_credit": "0.00"
}
Get Client
Sample axios request to get a single client
jsconst response = axios.get("/api/v3/clients/:id");
Where :id is the id of the client
The Response object received is same as the response after Creating a Client
Update a Client
To update a client, make a POST request to the /api/v3/clients/:id endpoint.
:idrepresents the id of the client you want to update
Check out Creating a Client to see how to make the request and the shape of the RESPONSE object
Get Summary
This returns an Object containing the summary information of the various clients
To get clients summary, make a GET request to the /api/v3/clients/summary?category_id endpoint. Sample request using axios:
Where category_id is the id of the category
jsconst response = await axios.get("/api/v3/clients/summary?category_id");
Delete a Client
To delete a client, make a DELETE request to the /api/v3/clients/:id endpoint. Here is a sample request using axios
Where :id is the id of the client to delete
jsconst response = await axios.delete("/api/v3/clients/:id");
Get Client Transactions
This returns an Object containing the summary information about your customers
To get client transactions, make a GET request to the /api/v3/clients/:id/transactions?from&to endpoint. Sample request using axios:
jsconst response = await axios.get("/api/v3/clients/:id/transactions?from&to");
Sample Response object:
json{
{
"id": 154186,
"owner_id": 1,
"business_id": 1,
"first_name": null,
"last_name": null,
"phone_number": null,
"business_name": "",
"business_address": "",
"business_phone": "",
"business_location": null,
"business_email": "",
"created_at": "2024-11-04T16:24:13.000000Z",
"updated_at": "2024-11-04T16:24:13.000000Z",
"account_id": 1080949,
"category": "Class of 2021",
"category_id": 1224,
"deposit_amount": 0,
"deposit_account_id": null,
"archived": false,
"transactions": [],
"unformated_balance": 0,
"balance": "0.00",
"total_debit": "0.00",
"total_credit": "0.00"
},
{
"id": 779,
"owner_id": 1,
"business_id": 1,
"first_name": "",
"last_name": "",
"phone_number": "",
"business_name": "Abas two",
"business_address": "",
"business_phone": "0265653314",
"business_location": "",
"business_email": "[email protected]",
"created_at": "2020-07-25T14:32:11.000000Z",
"updated_at": "2024-11-04T14:16:51.000000Z",
"account_id": 18156,
"category": "Uncategorised",
"category_id": 1,
"deposit_amount": 50939,
"deposit_account_id": null,
"archived": false,
"transactions": [],
"unformated_balance": 20364034.53,
"balance": "20,364,034.53",
"total_debit": "43,240,449.10",
"total_credit": "22,876,414.57"
},
{
"id": 2319,
"owner_id": 1,
"business_id": 1,
"first_name": "Katulie",
"last_name": "Yusif",
"phone_number": "",
"business_name": "Abdul Rashid Enterprise",
"business_address": "Darkumah, Accra. Ghana",
"business_phone": "0200000000",
"business_location": "",
"business_email": "[email protected]",
"created_at": "2020-11-24T14:18:21.000000Z",
"updated_at": "2023-12-20T12:09:28.000000Z",
"account_id": 37926,
"category": "Uncategorised",
"category_id": 1,
"deposit_amount": 26602.6,
"deposit_account_id": null,
"archived": false,
"transactions": [],
"unformated_balance": 15259701.62,
"balance": "15,259,701.62",
"total_debit": "139,511,520.16",
"total_credit": "124,251,818.54"
},
}
Query Params of the request
from: the beginning of the date of the transaction being requestedto: the end of the date of the transaction being requestedid: the transaction identifier
Archive/Unarchive Clients
To archive/unarchive clients, make a POST request to the /api/v3/clients/:id/archive endpoint. Sample request using axios:
jsconst response = await axios.post("/api/v3/clients/:id/archive",
{
"id": 154186,
"owner_id": 1,
"business_id": 1,
"first_name": null,
"last_name": null,
"phone_number": null,
"business_name": "",
"business_address": "",
"business_phone": "",
"business_location": null,
"business_email": "",
"created_at": "2024-11-04T16:24:13.000000Z",
"updated_at": "2024-11-27T15:22:17.000000Z",
"account_id": 1080949,
"category": "Class of 2021",
"category_id": 1224,
"deposit_amount": 0,
"deposit_account_id": null,
"archived": true
}
{
headers: {
accept: "application/json",
authorization: "Bearer <API-KEY>",
"content-type": "application/json",
},
}
);