Sales Orders – OptoSoft API

Search sales orders with paging, read a single order and its line items, list orders carrying an outstanding balance, change order status and cancel an order with a reason.

10 endpoints in this module. Every request needs a JWT bearer token — see Authentication.

JWT bearer auth JSON request & response 85 documented endpoints Reviewed monthly

Sales Orders

A sales order is the central transactional record in OptoSoft: what the customer ordered, what it costs, when it is due for delivery, how much has been paid, and where it currently sits in the fulfilment workflow.

In an optical store an order usually cannot be delivered immediately — lenses go to a lab for surfacing and fitting. The order therefore moves through a status lifecycle and accrues receipts (advances and final payments) along the way. These endpoints let you read that state and drive it forward.

Order paths are not consistently typed. Most take an encrypted string ID, but /api/Orders/{salesOrderId}/items takes a numeric int64. Others key on the human-readable salesOrderNo rather than an ID at all. Each endpoint below states which it expects — check before wiring it up.

Reading a single order

GET /api/Orders/{salesOrderNo} Bearer token

Fetches a complete order by its human-readable order number — not by ID. This is what you call when a customer quotes their order number at the counter or over the phone.

Path parameters

NameTypeRequiredDescription
salesOrderNostringRequiredOrder number as printed on the customer’s copy. URL-encode any slashes.

Example request

curl "https://api.opto-soft.com/api/Orders/SO%2F2026%2F001842" \
  -H "Authorization: Bearer YOUR_TOKEN"

Errors

StatusCause
404No order with that number in the token’s company and branch scope.
500Server error. Retry with backoff.
GET /api/Orders/{salesOrderNo}/ids Bearer token

Resolves an order number into the encrypted IDs the rest of the API needs. This is the bridge between the number a human knows and the identifiers the API expects.

Path parameters

NameTypeRequiredDescription
salesOrderNostringRequiredThe order number.

Response

{
  "salesOrderID": "ENCRYPTED_SALES_ORDER_ID",
  "customerID": "ENCRYPTED_CUSTOMER_ID"
}

Example request

curl "https://api.opto-soft.com/api/Orders/SO%2F2026%2F001842/ids" \
  -H "Authorization: Bearer YOUR_TOKEN"
GET /api/Orders/{salesOrderId}/items Bearer token

Returns the line items on an order — frames, lenses, contact lenses and accessories, with quantity, price, discount and GST breakdown.

Path parameters

NameTypeRequiredDescription
salesOrderIdint64RequiredNumeric sales order ID — not the encrypted string used elsewhere.

This is the one order endpoint that takes a plain numeric ID. Passing the encrypted id from /api/Orders/search here will fail to bind.

Example request

curl https://api.opto-soft.com/api/Orders/104822/items \
  -H "Authorization: Bearer YOUR_TOKEN"
GET /api/Orders/{salesOrderId}/advance-receipt-data Bearer token

Returns everything needed to take an advance payment against an order: the customer, the order total, what has already been received and the balance still outstanding. Call this before recording a receipt.

Path parameters

NameTypeRequiredDescription
salesOrderIdstringRequiredEncrypted sales order ID.

Response

FieldTypeDescription
salesOrderIDstringEncrypted order ID, echoed back.
customerIDstringEncrypted customer ID.
customerNamestringFull customer name.
customerFirstNamestringGiven name, for greetings on the receipt.
customerMobileNostringMobile number.
custmoerEmailstringEmail address. Note the spelling in the API.
soTotalAmountdoubleOrder total.
soTotalDiscountAmountdoubleDiscount on the order.
receiptTotalAmountdoubleTotal already received.
balancedoubleAmount still outstanding.
statusIDint32Current order status.
membershipIDstringEncrypted membership ID, if the customer is a member.

Example request

curl https://api.opto-soft.com/api/Orders/ENCRYPTED_SALES_ORDER_ID/advance-receipt-data \
  -H "Authorization: Bearer YOUR_TOKEN"

Errors

StatusCause
404Order not found in the token’s scope.

Balances and dropdowns

GET /api/Orders/with-balance Bearer token

Lists every order in a financial year that still has money outstanding. This is the receivables view — useful for a collections report or a payment-reminder campaign.

Query parameters

NameTypeRequiredDescription
yearIdint64RequiredFinancial year to report on.

Example request

curl "https://api.opto-soft.com/api/Orders/with-balance?yearId=9" \
  -H "Authorization: Bearer YOUR_TOKEN"
GET /api/Orders/dropdown Bearer token

A lightweight list of one customer’s orders with their balances — designed to populate a picker when taking a payment, so the cashier can see which order to apply it to.

Query parameters

NameTypeRequiredDescription
customerIdstringRequiredEncrypted customer ID.
yearIdint64RequiredFinancial year.

Response

FieldTypeDescription
salesOrderIDstringEncrypted order ID.
salesOrderNOstringOrder number.
soNetAmountdoubleOrder total.
receiptTotaldoubleReceived so far.
balanceAmountdoubleOutstanding balance.

Example request

curl "https://api.opto-soft.com/api/Orders/dropdown?customerId=ENCRYPTED_CUSTOMER_ID&yearId=9" \
  -H "Authorization: Bearer YOUR_TOKEN"

Status and cancellation

GET /api/Orders/cancellation-reasons Bearer token

Returns the configured cancellation reasons. Fetch this once and cache it to populate a reason picker.

Response

FieldTypeDescription
idint64Reason ID.
cancellationReasonstringDisplay text.
isActivebooleanOnly offer active reasons.

Example request

curl https://api.opto-soft.com/api/Orders/cancellation-reasons \
  -H "Authorization: Bearer YOUR_TOKEN"
PUT /api/Orders/{salesOrderId}/status Bearer token

Moves an order to a new status — for example from In Process to Ready for Delivery when the lab returns the job. This is the endpoint a lab-management or workflow integration drives.

Path parameters

NameTypeRequiredDescription
salesOrderIdstringRequiredEncrypted sales order ID.

Request body

FieldTypeRequiredDescription
statusIdint64RequiredTarget status ID. Read current values from the statusID field on /api/Orders/search results.

Example request

curl -X PUT https://api.opto-soft.com/api/Orders/ENCRYPTED_SALES_ORDER_ID/status \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "statusId": 3 }'

Errors

StatusCause
400Invalid status transition, or an unrecognised statusId.
401Token missing or expired.
500Server error.
POST /api/Orders/{salesOrderId}/cancel Bearer token

Cancels an order and simultaneously settles the treatment of any receipts already taken against it. Because it touches money, it takes both an order status and a receipt status.

Path parameters

NameTypeRequiredDescription
salesOrderIdstringRequiredEncrypted sales order ID.

Request body

FieldTypeRequiredDescription
statusIdint32RequiredCancellation status to apply to the order.
receiptStatusIdint32RequiredHow to treat existing receipts (for example refunded or retained as credit).
datedate-timeRequiredCancellation date.
transactionDatedate-timeRequiredAccounting date the cancellation posts against.

Example request

curl -X POST https://api.opto-soft.com/api/Orders/ENCRYPTED_SALES_ORDER_ID/cancel \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "statusId": 5,
    "receiptStatusId": 2,
    "date": "2026-07-26T00:00:00",
    "transactionDate": "2026-07-26T00:00:00"
  }'

Cancellation is not reversible through the API. There is no un-cancel endpoint. Confirm the reason and the receipt treatment with the operator before calling this.

Errors

StatusCause
400Order already cancelled or invoiced, or an invalid status combination.
401Token missing or expired.
500Server error.
Chat with us Call us