Shop API Overview
The Shop API allows you to manage your product catalog, categories, and orders programmatically.
Build complete e-commerce experiences with our comprehensive Shop module. From product management to order processing, you have full control over your online store's backend operations. The Shop API is designed to work seamlessly with payment processing and customer management features.
What You Can Build
- Online Stores: Complete product catalogs with pricing, inventory, and images
- Marketplace Backends: Enable multiple vendors to manage products
- POS Systems: Create orders and manage products for physical stores
- Inventory Systems: Sync product data with external inventory management
Available Endpoints
Products
| Method | Endpoint | Description |
|---|---|---|
GET | /business/product/list | List all products |
GET | /business/product/details/:id | Get product details |
POST | /business/product/create | Create a new product |
PATCH | /business/product/update/:id | Update a product |
Product Categories
| Method | Endpoint | Description |
|---|---|---|
GET | /business/product-category/list | List all categories |
POST | /business/product-category/create | Create a category |
PATCH | /business/product-category/update/:id | Update a category |
Orders
| Method | Endpoint | Description |
|---|---|---|
POST | /business/order/checkout | Create an order checkout |
Quick Examples
List Products
bash
curl -X GET "https://api.cashfin.africa/business/product/list" \
-H "Authorization: cs_your_client_secret"Create a Product
bash
curl -X POST "https://api.cashfin.africa/business/product/create" \
-H "Authorization: cs_your_client_secret" \
-H "Content-Type: application/json" \
-d '{
"title": "Premium Widget",
"price": 1999.99,
"stock": 100
}'Create an Order
bash
curl -X POST "https://api.cashfin.africa/business/order/checkout" \
-H "Authorization: cs_your_client_secret" \
-H "Content-Type: application/json" \
-d '{
"customeremail": "[email protected]",
"items": [
{
"itemid": "507f1f77bcf86cd799439011",
"quantity": 2,
"rate": 1999.99
}
]
}'Product Types
Products can be one of three types:
| Type | Description |
|---|---|
product | Physical or digital goods |
service | Service offerings |
plan | Subscription plans |
Product Statuses
| Status | Description |
|---|---|
published | Visible to customers |
draft | Not visible, work in progress |
archived | Hidden, no longer available |
Use Cases
E-commerce Integration
Sync your product catalog from an external system:
javascript
async function syncProducts(externalProducts) {
for (const product of externalProducts) {
await fetch("https://api.cashfin.africa/business/product/create", {
method: "POST",
headers: {
Authorization: API_KEY,
"Content-Type": "application/json",
},
body: JSON.stringify({
title: product.name,
price: product.price,
stock: product.inventory,
sku: product.sku,
description: product.description,
}),
});
}
}Order Processing
Create orders from your custom storefront:
javascript
async function createOrder(cart, customerEmail) {
const items = cart.map((item) => ({
itemid: item.productId,
quantity: item.quantity,
rate: item.price,
}));
const response = await fetch(
"https://api.cashfin.africa/business/order/checkout",
{
method: "POST",
headers: {
Authorization: API_KEY,
"Content-Type": "application/json",
},
body: JSON.stringify({
customeremail: customerEmail,
items: items,
}),
}
);
return response.json();
}Inventory Management
Update stock levels in real-time:
javascript
async function updateStock(productId, newStock) {
await fetch(
`https://api.cashfin.africa/business/product/update/${productId}`,
{
method: "PATCH",
headers: {
Authorization: API_KEY,
"Content-Type": "application/json",
},
body: JSON.stringify({
stock: newStock,
}),
}
);
}Next Steps
- Products API - Detailed product endpoints
- Categories API - Category management
- Orders API - Order checkout and management