OSuiteStart free trial

Order inbox (desktop without a tunnel)

For an OSuite your website cannot reach: offer a feed of orders that OSuite fetches when online.

When to use it

The business runs OSuite on a desktop without Remote access, so your server cannot call it. Instead you keep orders in a feed; OSuite fetches it every 5 minutes while online, bills each order once and tells you the number. Invoices are made only while OSuite is online: goods need theirs by dispatch, so a business that ships often is better on the cloud edition or Remote access with the Billing API.

Setting it up

In OSuite, Connections › Your website’s orders › Add a website: the feed address and, optionally, a callback address. OSuite gives the feed secret.

The feed

GET <your feed address>?after=<the next value you last answered>, with Authorization: Bearer <the feed secret OSuite gave>.

200 with JSON { "orders": [order], "next": "<where to continue>" } and the header X-OSuite-Signature: sha256=<hex HMAC-SHA256 of the exact body, keyed with the feed secret>. At most 200 orders an answer, and 2 MB.

As the body of POST /api/v1/invoices, with "id" (your order id, unique) and, for an order already paid, "paid": { amount, mode, reference }. "test": true makes that one order a TEST draft even on a live feed, for a sample. "liveOnly": true holds a real sale while the feed is in test mode, and bills it once the feed goes live.

              // Node: answer OSuite's fetch with new orders, signed with the feed secret.
import { createHmac } from 'node:crypto';
app.get('/osuite/orders', async (req, res) => {
  if (req.get('authorization') !== `Bearer ${process.env.OSUITE_FEED_SECRET}`) return res.sendStatus(401);
  const orders = await ordersAfter(req.query.after); // yours: oldest first, up to 200
  const body = JSON.stringify({ orders, next: orders.at(-1)?.id ?? req.query.after ?? '' });
  const signature = createHmac('sha256', process.env.OSUITE_FEED_SECRET).update(body).digest('hex');
  res.set('content-type', 'application/json').set('x-osuite-signature', `sha256=${signature}`).send(body);
});
            

Being told

POST <your callback address> with JSON { orderId, status: "billed" | "failed", reissuedFrom?, invoice?: { id, number, status, date, total, due, viewUrl, payUrl, pdf }, error?, warnings? }, where pdf is the posted invoice as base64, and reissuedFrom is the number the sale’s invoice had before: when OSuite reissues an invoice or gives it back its original number, the order is told again, and you replace that number and PDF with these. It comes with headers X-OSuite-Timestamp and X-OSuite-Signature: sha256=<hex HMAC-SHA256 of "<timestamp>.<body>">. Answer 2xx; OSuite tells you again until you do.

An order that cannot be billed is tried 5 times, then you are told it failed with why, and so are the business’s administrators.

Also as Markdown. See the API reference for every field.