Fiscal Note Requested
Once a connection is active, OlaClick sends a FISCAL_NOTES_REQUEST event to your webhook when an order is ready for invoicing.
Flow
- A company's order is completed in OlaClick
- OlaClick sends a
FISCAL_NOTES_REQUESTevent to your webhook URL - You respond with
200 OKconfirming receipt - You fetch the full order data with
GET /v1/orders/:idusing theorder_idfrom the event - You emit the invoice with the fiscal authority
- You notify OlaClick with the result via
PATCH /v1/fiscal-notes/confirmation(see Notify Invoice)
Webhook event
The FISCAL_NOTES_REQUEST event data contains order_id, country_code, and electronic_invoice_id — not the full order. Use the API to fetch the complete order details.
Event reference:
FISCAL_NOTES_REQUEST— full payload and schema.
Fetching the order
Use the order_id from the event to get the full order (products, totals, payments, client info). This requires a Company Token — see Authentication.
API Reference:
GET /v1/orders/:id— Required scope:orders:read
Complete flow example
app.post('/webhooks/olaclick', async (req, res) => {
// 1. Verify signature (see Signature Verification)
if (!verifySignature(req.rawBody, req.headers['x-olaclick-signature'], SIGNING_SECRET)) {
return res.status(401).json({ error: 'invalid_signature' });
}
const { event_type, data } = req.body;
if (event_type === 'FISCAL_NOTES_REQUEST') {
const { order_id, country_code, electronic_invoice_id } = data;
// 2. Get a Company Token for this company
// companyId comes from your storage — mapped from the merchant_id
// you received in the CONNECTION_CREATED binding event
const token = await getCompanyToken(companyId);
// 3. Fetch full order data
const order = await fetch(`https://public-api.olaclick.app/v1/orders/${order_id}`, {
headers: { Authorization: `Bearer ${token}` },
}).then((r) => r.json());
// 4. Emit invoice with fiscal authority (your logic)
const result = await emitInvoice(order, country_code);
// 5. Confirm result to OlaClick
await fetch('https://public-api.olaclick.app/v1/fiscal-notes/confirmation', {
method: 'PATCH',
headers: {
Authorization: `Bearer ${token}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
order_id,
status: result.success ? 'COMPLETED' : 'REQUEST_ERROR',
invoice_number: result.invoiceNumber,
message: result.message,
}),
});
}
res.json({ status: 'received' });
});