Skip to content

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

MethodEndpointDescription
GET/business/product/listList all products
GET/business/product/details/:idGet product details
POST/business/product/createCreate a new product
PATCH/business/product/update/:idUpdate a product

Product Categories

MethodEndpointDescription
GET/business/product-category/listList all categories
POST/business/product-category/createCreate a category
PATCH/business/product-category/update/:idUpdate a category

Orders

MethodEndpointDescription
POST/business/order/checkoutCreate 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:

TypeDescription
productPhysical or digital goods
serviceService offerings
planSubscription plans

Product Statuses

StatusDescription
publishedVisible to customers
draftNot visible, work in progress
archivedHidden, 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

Cashfin Business API Documentation