Comprehensive guide for developers integrating with digiMall APIs, webhooks, and third-party services for advanced vendor functionality
digiMall provides robust APIs and developer tools that enable 90% faster integration compared to traditional e-commerce platforms, with comprehensive documentation and support.
digiMall provides RESTful APIs that allow vendors to integrate their existing systems, automate workflows, and build custom applications on top of the platform.
Follow this step-by-step guide to set up your first API integration and authenticate your application with digiMall's systems.
BASE_URL=https://api.digimall.ng/v1
API_KEY=your_api_key_here
API_SECRET=your_api_secret_here
WEBHOOK_SECRET=your_webhook_secret
Implement OAuth 2.0 flow or API key authentication depending on your integration requirements.
const axios = require('axios');
// Step 1: Get authorization code
const authUrl = 'https://api.digimall.ng/oauth/authorize' +
'?client_id=your_client_id' +
'&response_type=code' +
'&scope=products.read orders.write' +
'&redirect_uri=https://yourapp.com/callback';
// Step 2: Exchange code for access token
const tokenResponse = await axios.post(
'https://api.digimall.ng/oauth/token',
{
grant_type: 'authorization_code',
client_id: 'your_client_id',
client_secret: 'your_client_secret',
code: 'authorization_code',
redirect_uri: 'https://yourapp.com/callback'
}
);
const accessToken = tokenResponse.data.access_token;Explore the most commonly used API endpoints for product management, order processing, and business operations.
Manage orders, process fulfillment, and track shipping status through automated workflows.
// Update order status to 'shipped'
const response = await fetch(
'https://api.digimall.ng/v1/orders/ORD-12345/status',
{
method: 'PUT',
headers: {
'Authorization': 'Bearer ' + accessToken,
'Content-Type': 'application/json'
},
body: JSON.stringify({
status: 'shipped',
tracking_number: 'TRK-789012',
carrier: 'DHL',
estimated_delivery: '2025-01-20',
notes: 'Package dispatched from Lagos warehouse'
})
}
);
const result = await response.json();
console.log('Order updated:', result);Set up webhooks to receive real-time notifications about important events in your vendor account, enabling automated responses and workflows.
order.created - New order receivedorder.updated - Order status changedpayment.completed - Payment processedproduct.updated - Product modifiedinventory.low - Stock running lowImplement proper webhook verification to ensure events are genuinely from digiMall and haven't been tampered with.
const crypto = require('crypto');
const express = require('express');
const app = express();
// Middleware to verify webhook signature
const verifyWebhook = (req, res, next) => {
const signature = req.headers['x-digimall-signature'];
const payload = JSON.stringify(req.body);
const secret = process.env.WEBHOOK_SECRET;
const expectedSignature = crypto
.createHmac('sha256', secret)
.update(payload)
.digest('hex');
if (signature !== 'sha256=' + expectedSignature) {
return res.status(401).send('Invalid signature');
}
next();
};
// Webhook endpoint
app.post('/webhooks/digimall',
express.json(),
verifyWebhook,
(req, res) => {
const { event, data } = req.body;
switch (event) {
case 'order.created':
handleNewOrder(data);
break;
case 'payment.completed':
processPayment(data);
break;
// Handle other events...
}
res.status(200).send('OK');
}
);Connect digiMall with popular business tools and services to create powerful automated workflows and extend platform functionality.
Use built-in testing tools and debugging features to develop and troubleshoot your API integrations effectively.
Monitor API usage, track errors, and debug integration issues with comprehensive logging and analytics.
Detailed API call history and responses
Real-time error notifications and analysis
API response times and usage analytics
Understand API rate limits and implement best practices for reliable, efficient integrations that scale with your business growth.