एक REST API जो आपके storefront के orders सीधे OrderMatrix में push करता है — real-time status webhooks, idempotent delivery, और HMAC-verified payloads।
Settings → Developers में API key बनाएं। हर request में इसे Authorization header में भेजें। Key एक बार दिखती है और हमारे servers पर plaintext में store नहीं होती।
Authorization: Bearer om_live_xxxxxxxxxxxxxxxx
/v1/orders पर order POST करें। externalRef (अपना order ID) दें और call idempotent बन जाती है — वही reference दोबारा भेजने पर existing order मिलता है, duplicate नहीं बनता।
curl -X POST https://api.ordermatrix.in/v1/orders \
-H "Authorization: Bearer om_live_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"externalRef": "shop-order-1234",
"customer": { "name": "Priya Sharma", "phone": "9876543210" },
"address": { "line1": "12 MG Road", "city": "Bengaluru", "state": "Karnataka", "pincode": "560001" },
"items": [{ "sku": "LIP-001", "name": "Red Lipstick", "price": 499, "qty": 2 }],
"shipping": 50,
"total": 1048,
"paymentMethod": "prepaid",
"paymentRef": "pay_abc123"
}'externalRef से वही order वापस लाएं:
curl https://api.ordermatrix.in/v1/orders?externalRef=shop-order-1234 \ -H "Authorization: Bearer om_live_your_key_here"
Settings → Developers में webhook URL दर्ज करें। हर स्टेटस बदलाव पर — shipped, delivered, cancelled — OrderMatrix आपके endpoint पर JSON पेलोड POST करेगा। X-OM-Signature header सत्यापित करें।
{
"event": "order.shipped",
"orderId": "665f...",
"orderNo": "ORD-2026-0042",
"externalRef": "shop-order-1234",
"status": "dispatched",
"tracking": { "courier": "Delhivery", "awb": "1234567890" },
"at": "2026-10-01T14:30:00.000Z"
}const crypto = require('crypto');
function verifySignature(rawBody, receivedSig, secret) {
const expected = 'sha256=' + crypto
.createHmac('sha256', secret)
.update(rawBody)
.digest('hex');
return crypto.timingSafeEqual(
Buffer.from(expected),
Buffer.from(receivedSig),
);
}
// Express example
app.post('/webhook', express.raw({ type: 'application/json' }), (req, res) => {
const sig = req.headers['x-om-signature'];
if (!verifySignature(req.body, sig, process.env.WEBHOOK_SECRET)) {
return res.status(401).send('Unauthorized');
}
const event = JSON.parse(req.body);
console.log(event.event, event.status);
res.sendStatus(200);
});Deliveries 3 बार retry होती हैं — 0 s, 5 s, और 30 s पर। आपका endpoint 10 सेकंड में 2xx return करे।
मुफ़्त account बनाएं, API key generate करें, और पहला order मिनटों में OrderMatrix में आ जाएगा।