OSuiteStart free trial

A first invoice in five minutes

Make a billing token, then make, post and email an invoice from your website’s server.

1. Make a billing token

In OSuite, open Your account › API tokens. Name the token after your website (patilstore.in), choose Bill through the Billing API, and Make a token. Copy it: it is shown once.

For trying things out, tick Test key: its invoices stay drafts marked TEST and are never sent or numbered.

One sale, one invoice

One sale, one invoice, and it is OSuite’s. OSuite works out the GST and gives the number; your website shows the customer that number and that PDF, and never numbers or prints an invoice of its own. Two invoices for one sale would put your GST returns out of step with what your customer holds.

Fetch the invoice with GET /api/v1/invoices/{id}/pdf. With the order inbox, the PDF comes with the invoice number at your callback address.

2. Find your OSuite’s address

Your OSuite’s own address: the cloud edition’s, or a desktop’s Remote access address. Calls go there directly; OfinIT is not in between.

Below, replace YOUR-OSUITE with it, and keep the token in an environment variable on your server.

3. Make an invoice

              curl -X POST https://YOUR-OSUITE/api/v1/invoices \
  -H "Authorization: Bearer $OSUITE_TOKEN" \
  -H "Idempotency-Key: order-1001" \
  -H "Content-Type: application/json" \
  -d '{"customer":{"name":"Mehta Engineering","email":"buy@mehta.in","stateCode":"24"},"reference":"Order 1001","items":[{"sku":"LED-18","qty":4},{"description":"Installation","hsn":"9954","qty":1,"price":1000,"gstRate":18}],"expectTotal":3196,"send":["email"]}'
            

OSuite finds or adds the customer, fills the LED panel from its SKU, works out GST and the number, posts the invoice and emails it. The answer has the invoice with its viewUrl and payUrl, what was sent, and any warnings.

4. Next

Take payment on OSuite’s pay page with a hosted checkout, or record a payment your website took with POST /api/v1/invoices/{id}/payments. Send an Idempotency-Key with every call that makes something.

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