Quick Sale – OptoSoft API

The counter-billing workflow: build a cart in a temporary session, look up items by barcode or autocomplete, check live stock, then commit the sale, invoice and receipt in a single call.

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

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

Quick Sale

Quick Sale is OptoSoft’s counter-billing workflow — the fastest path from a customer walking in to a printed invoice and receipt. It is the largest module in the API at 28 endpoints, and it powers both the OptoSoft web POS and the free Android mobile POS app.

The model is a server-side cart. You open a session, add line items to a temporary order one at a time, adjust quantities and discounts, then commit the whole thing in a single call that creates the sales order, the invoice and the receipt together.

The workflow

  1. Generate a sessionID on your side (a GUID is fine).
  2. Find items by barcode with getItemDetailFromCode, or by autocomplete.
  3. Add each one with saveSalesOrderTemp.
  4. Read the running cart back with GetSalesOrderTemp to get live totals and tax.
  5. Adjust or remove lines as needed.
  6. Commit with SaveSale.

The session ID is yours to manage. OptoSoft keys the temporary cart on whatever string you supply. Use a fresh unique value per transaction, and always call deleteSalesOrderTempBySession if the customer walks away, or abandoned carts will accumulate.

Cart session

POST /api/quickSale/saveSalesOrderTemp Bearer token

Adds one line item to the temporary cart. Call it once per product. For a spectacle lens, the optical powers travel on the line itself — that is how a single order can carry different powers for each pair.

Most-used fields

FieldTypeRequiredDescription
sessionIDstringRequiredYour cart session key.
itemIDstringRequiredEncrypted item ID from a lookup call.
inventoryIDstringOptionalSpecific stock unit, when tracking serialised inventory.
qtydoubleRequiredQuantity.
mrpdoubleOptionalPrinted MRP.
pricedoubleRequiredSelling price per unit before discount.
discountRatedoubleOptionalPercentage discount.
discountAmountdoubleOptionalFlat discount. Use one or the other, not both.
sgstRatedoubleOptionalSGST percentage for intra-state sales.
cgstRatedoubleOptionalCGST percentage for intra-state sales.
igstRatedoubleOptionalIGST percentage for inter-state sales.
jobChargesdoubleOptionalLens fitting or lab charges on this line.
pairNostringOptionalGroups lines into pairs, so one order can hold two complete spectacles.
spectacleLensTypeint32OptionalLens type for a spectacle-lens line.
sphericalstringOptionalSPH power for this lens.
cylinderstringOptionalCYL power.
axisstringOptionalAxis in degrees.
additionstringOptionalADD power for bifocal or progressive.
pdstringOptionalPupillary distance.
lensFittingHeightdoubleOptionalFitting height for progressive lenses.
lensTotalHeightdoubleOptionalTotal lens height.
About the other fields (48 total)
GroupFields
Computed totalstotalMRP, totalPrice, taxableAmount, sgstAmount, cgstAmount, igstAmount, totalAmount
Service taxserviceTaxId, serviceTaxRate, serviceTaxAmount
Optical detailnear, vision, vn
AuditcreatedBy, createdDate, createdIP
Linkageid, salesOrderID, isOrdered

Leave the computed total and tax-amount fields unset. OptoSoft calculates them from qty, price, the discount and the GST rates.

Example request

curl -X POST https://api.opto-soft.com/api/quickSale/saveSalesOrderTemp \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "sessionID": "3f9c1a52-7b40-4e6d-9a11-0d2c8e5b7f31",
    "itemID": "ENCRYPTED_ITEM_ID",
    "qty": 1,
    "mrp": 4500,
    "price": 4500,
    "discountRate": 10,
    "sgstRate": 6,
    "cgstRate": 6,
    "pairNo": "1"
  }'
POST /api/quickSale/GetSalesOrderTemp Bearer token

Reads the current cart back with live totals. Extra charges are supplied here rather than stored on the cart, so the same session can be re-totalled under different charge assumptions.

Request body

FieldTypeRequiredDescription
sessionIdstringRequiredYour cart session key. Note the lower-case d here, unlike sessionID elsewhere.
jobChargesdoubleOptionalOrder-level fitting or lab charges.
shippingChargesdoubleOptionalDelivery charges.
otherChargesdoubleOptionalAny other charge line.
serviceTaxdoubleOptionalService tax rate on charges.
isCompositionSchemebooleanOptionalSet true if the store is registered under the GST composition scheme (no tax shown on the bill).
isCustomerStateNotSameAsCompanyStatebooleanOptionalDrives IGST instead of CGST + SGST.

Example request

curl -X POST https://api.opto-soft.com/api/quickSale/GetSalesOrderTemp \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "sessionId": "3f9c1a52-7b40-4e6d-9a11-0d2c8e5b7f31",
    "jobCharges": 150,
    "isCompositionScheme": false,
    "isCustomerStateNotSameAsCompanyState": false
  }'
POST /api/quickSale/update-sales-order-temp-values Bearer token

Edits one cart line in place — the quantity, price or discount stepper on a POS screen. Tax and totals are recalculated for you.

Request body

FieldTypeRequiredDescription
idstringRequiredEncrypted temporary-line ID from GetSalesOrderTemp.
qtydoubleRequiredNew quantity.
pricedoubleRequiredNew unit price.
discountRatedoubleOptionalNew percentage discount.
discountAmountdoubleOptionalNew flat discount.

Example request

curl -X POST https://api.opto-soft.com/api/quickSale/update-sales-order-temp-values \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "id": "ENCRYPTED_TEMP_LINE_ID",
    "qty": 2,
    "price": 4500,
    "discountRate": 15
  }'
POST /api/quickSale/delete-salesorder-temp Bearer token

Removes a single line, or a whole pair, from the cart.

Request body

FieldTypeRequiredDescription
sessionIDstringRequiredCart session key.
salesOrderTempIdstringOptionalEncrypted line ID to remove.
pairNostringOptionalRemove every line in this pair instead of a single line.

Example request

curl -X POST https://api.opto-soft.com/api/quickSale/delete-salesorder-temp \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "sessionID": "3f9c1a52-7b40-4e6d-9a11-0d2c8e5b7f31",
    "salesOrderTempId": "ENCRYPTED_TEMP_LINE_ID"
  }'
POST /api/quickSale/deleteSalesOrderTempBySession Bearer token

Abandons the whole cart. Call this whenever a transaction is cancelled, and on start-up for any session your client did not finish.

Request body

FieldTypeRequiredDescription
sessionIDstringRequiredCart session key to clear.

Example request

curl -X POST https://api.opto-soft.com/api/quickSale/deleteSalesOrderTempBySession \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "sessionID": "3f9c1a52-7b40-4e6d-9a11-0d2c8e5b7f31" }'

Item lookup and stock

GET /api/quickSale/getItemDetailFromCode Bearer token

Resolves a barcode or item code into a full item record with price and tax rates. This is the barcode-scanner endpoint — the fastest way to add a frame or accessory to the cart.

Query parameters

NameTypeRequiredDescription
codestringRequiredBarcode or item code, exactly as scanned.

Example request

curl "https://api.opto-soft.com/api/quickSale/getItemDetailFromCode?code=8901234567890" \
  -H "Authorization: Bearer YOUR_TOKEN"
GET /api/quickSale/getExactItemStock Bearer token

Returns the live on-hand quantity for one item. Call it before committing a sale to avoid overselling a frame that is down to its last piece.

Query parameters

NameTypeRequiredDescription
itemIdint64RequiredNumeric item ID, not the encrypted string.

Example request

curl "https://api.opto-soft.com/api/quickSale/getExactItemStock?itemId=88214" \
  -H "Authorization: Bearer YOUR_TOKEN"
GET /api/quickSale/GetFrameSunGlassForAutoComplete Bearer token

Type-ahead search across frames and sunglasses. Use it when the barcode is unreadable or the customer is browsing by brand or model.

Query parameters

NameTypeRequiredDescription
termstringRequiredPartial brand, model or code. Send at least 2 characters.
yearIdint64RequiredFinancial year to search stock within.

Example request

curl "https://api.opto-soft.com/api/quickSale/GetFrameSunGlassForAutoComplete?term=rayban&yearId=9" \
  -H "Authorization: Bearer YOUR_TOKEN"
GET /api/quickSale/GetSpectacleLensForAutoComplete Bearer token

Type-ahead search across spectacle lenses. Unlike the frame search, this takes no year parameter.

Query parameters

NameTypeRequiredDescription
termstringRequiredPartial lens name, coating or index.

Example request

curl "https://api.opto-soft.com/api/quickSale/GetSpectacleLensForAutoComplete?term=progressive" \
  -H "Authorization: Bearer YOUR_TOKEN"
POST /api/quickSale/search-contact-lens Bearer token

Searches contact lenses. This one is a POST with a JSON body rather than a query string, unlike the two autocomplete endpoints above.

Request body

FieldTypeRequiredDescription
termstringRequiredPartial brand, power or modality.

Example request

curl -X POST https://api.opto-soft.com/api/quickSale/search-contact-lens \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "term": "acuvue" }'
GET /api/quickSale/get-item-type-id Bearer token

Resolves an item type by its numeric ID — used to decide which cart section (frame, lens, contact lens, accessory) a scanned item belongs in.

Query parameters

NameTypeRequiredDescription
idint32RequiredNumeric item-type ID.

Example request

curl "https://api.opto-soft.com/api/quickSale/get-item-type-id?id=3" \
  -H "Authorization: Bearer YOUR_TOKEN"

Committing the sale

POST /api/quickSale/SaveSale Bearer token

The commit call. Converts the temporary cart into a real transaction — sales order, invoice, receipt, stock movement and any lab purchase order — in one atomic operation.

The body is the composite OMFastWizardModel, the same object used by /api/Invoice/save-invoice-data. Its top-level structure is documented on the Invoices page.

Key fields

FieldTypeDescription
sessionIDstringThe cart session to convert. This is what links the call to the lines you added.
customerModelobjectThe customer. Can create a new one inline during the sale.
salesorderModelobjectOrder-level values: dates, delivery mode, charges, remarks.
receiptModelobjectPayment taken at the counter. Omit to leave the order fully unpaid.
eyeInfoModelobjectThe prescription being dispensed.
eyecheckupRecallModelobjectSchedules the next eye-test recall for WhatsApp or SMS follow-up.
purchaseOrderModelobjectLab order raised for lens surfacing and fitting.
orderDatedate-timeTransaction date.
expectedDatedate-timePromised delivery date.
supplierIDstringEncrypted supplier ID for the lab job.
fitterIDstringEncrypted fitter ID.
priorityIDstringEncrypted job-priority ID.
userIdint64Operator recording the sale.

Do not retry blindly on a timeout. This call creates financial documents. If it times out, query POST /api/Orders/search for the session’s customer and date range to check whether the order was in fact created before re-sending.

Example request

curl -X POST https://api.opto-soft.com/api/quickSale/SaveSale \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  --data-binary @sale.json
POST /api/quickSale/SaveInvoiceOnly Bearer token

Raises an invoice against an order that already exists, without recreating the order. This is the delivery-day call: the customer collects their spectacles and the tax invoice is generated.

Request body

FieldTypeRequiredDescription
salesOrderIDstringRequiredEncrypted sales order ID to invoice.
customerIDstringRequiredEncrypted customer ID.
sessionIDstringOptionalCart session, if the invoice was assembled through one.
invoiceDatedate-timeRequiredInvoice date. Determines the GST return period.
isCompositionSchemebooleanOptionalSet true for composition-scheme stores.

Example request

curl -X POST https://api.opto-soft.com/api/quickSale/SaveInvoiceOnly \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "salesOrderID": "ENCRYPTED_SALES_ORDER_ID",
    "customerID": "ENCRYPTED_CUSTOMER_ID",
    "invoiceDate": "2026-07-29T00:00:00",
    "isCompositionScheme": false
  }'
POST /api/quickSale/SaveReceipt Bearer token

Records a payment. Use it for an advance at order time, for the balance on delivery, or for a standalone payment not tied to an invoice.

The model is large (164 fields) because it doubles as the print payload — it carries branch letterhead, terms and totals for the printed receipt as well as the payment itself. In practice you set a small subset.

Most-used fields

FieldTypeRequiredDescription
salesOrderIDstringRequiredEncrypted order the payment applies to.
receiptAmountdoubleRequiredAmount being taken now.
receiptTypeIdint64RequiredPayment method. Values from GET /api/quickSale/Fetch-Receipt-Type.
yearIdstringRequiredEncrypted financial-year ID.
branchIdint64RequiredNumeric branch ID.
receiptIdstringOptionalEncrypted receipt ID. Omit to create a new receipt.
referenceNostringOptionalCheque number, UPI reference or card transaction ID.
salesOrderNostringOptionalOrder number, printed on the receipt.
netAmountdoubleOptionalOrder net amount, for the printed summary.
statusIdint32OptionalReceipt status, for example cleared or pending.
taxNotApplicablebooleanOptionalSet true for non-GST transactions, including most sales outside India.
isForeignerbooleanOptionalMarks an overseas customer.
receiptPrintFormatint32OptionalWhich receipt template to render.
About the other fields (164 total)
GroupPurpose
Branch letterheadbranchName, branchAddress, branchCity, branchEmail, branchMobile and similar — printed header. Populate from get-branch-details.
Tax totalstotalTaxableAmount, totalSGST, totalCGST, totalIGST, rounding, totalDiscount — computed by OptoSoft.
Print layoutreceiptName, intrenalReceiptName, isExternalReceiptFormat, signature, termsAndConditions.
Repair jobsrepairingID, repairingNO — only for repair receipts.
Line detailItem-level arrays mirroring the order, used to render the receipt body.

Example request

curl -X POST https://api.opto-soft.com/api/quickSale/SaveReceipt \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "salesOrderID": "ENCRYPTED_SALES_ORDER_ID",
    "yearId": "ENCRYPTED_YEAR_ID",
    "branchId": 24,
    "receiptTypeId": 2,
    "receiptAmount": 3000,
    "referenceNo": "UPI-402291837",
    "salesOrderNo": "SO/2026/001842"
  }'

Receipt helpers

GET /api/quickSale/Fetch-Receipt-Type Bearer token

Lists the configured payment methods — cash, card, UPI, cheque, credit note and so on. Fetch once at start-up and cache; the IDs feed receiptTypeId on SaveReceipt.

Example request

curl https://api.opto-soft.com/api/quickSale/Fetch-Receipt-Type \
  -H "Authorization: Bearer YOUR_TOKEN"
GET /api/quickSale/GetReceiptDetails Bearer token

Returns the full detail of one receipt, in the shape needed to reprint it.

Query parameters

NameTypeRequiredDescription
customerIdint64RequiredNumeric customer ID.
receiptIdint64RequiredNumeric receipt ID.
salesOrderIdint64RequiredNumeric sales order ID.

Example request

curl "https://api.opto-soft.com/api/quickSale/GetReceiptDetails?customerId=30188&receiptId=77120&salesOrderId=104822" \
  -H "Authorization: Bearer YOUR_TOKEN"
GET /api/quickSale/get-credit-notes Bearer token

Lists unredeemed credit notes held by a customer — from returns, cancellations or goodwill adjustments — so they can be applied against a new sale.

Query parameters

NameTypeRequiredDescription
customerIdint64RequiredNumeric customer ID.

Example request

curl "https://api.opto-soft.com/api/quickSale/get-credit-notes?customerId=30188" \
  -H "Authorization: Bearer YOUR_TOKEN"

Eight small lookup endpoints populate the pickers on a POS screen. All are cheap, all are cacheable, and none change during a trading day — fetch them once at start-up.

GET /api/quickSale/get-doctors-dropdown Bearer token

Referring doctors, in picker form. The fuller doctor master with addresses lives in Customers & Prescriptions.

Query parameters

None.

GET /api/quickSale/get-fitters-dropdown Bearer token

Staff who fit lenses into frames. Feeds fitterID on SaveSale.

Query parameters

None.

GET /api/quickSale/get-suppliers-dropdown Bearer token

Labs and suppliers used for lens surfacing. Feeds supplierID on the purchase order raised with a sale.

Query parameters

None.

GET /api/quickSale/get-priority-dropdown Bearer token

Job priorities — normal, urgent, same-day. Feeds priorityID and drives the promised delivery date.

Query parameters

None.

GET /api/quickSale/getGenders Bearer token

Gender options with their encrypted IDs, for genderID on customer upsert.

Query parameters

None.

GET /api/quickSale/getSources Bearer token

Customer acquisition sources — walk-in, referral, online, campaign. Paged, unusually for a lookup.

Query parameters

NameTypeRequiredDescription
pageint32Optional1-based page index.
pageSizeint32OptionalRows per page.

Example request

curl "https://api.opto-soft.com/api/quickSale/getSources?page=1&pageSize=100" \
  -H "Authorization: Bearer YOUR_TOKEN"
GET /api/quickSale/getMemberships Bearer token

Loyalty and membership schemes, with their encrypted IDs. Paged like getSources.

Query parameters

NameTypeRequiredDescription
pageint32Optional1-based page index.
pageSizeint32OptionalRows per page.

Example request

curl "https://api.opto-soft.com/api/quickSale/getMemberships?page=1&pageSize=50" \
  -H "Authorization: Bearer YOUR_TOKEN"
GET /api/quickSale/allCard Bearer token

Lists the card types configured for card payments, for the picker shown when receiptTypeId is a card method.

Query parameters

None.

Branch and app

GET /api/quickSale/get-branch-details Bearer token

Returns the branch profile for the token’s scope — name, address, GSTIN, phone and email. Use it to populate the letterhead fields on SaveReceipt and on printed documents.

Query parameters

None. Scope comes from the bearer token.

Example request

curl https://api.opto-soft.com/api/quickSale/get-branch-details \
  -H "Authorization: Bearer YOUR_TOKEN"
GET /api/quickSale/app-version Bearer token

Returns the minimum supported client version. The OptoSoft Android POS app calls this on launch to decide whether to prompt for an update. Worth calling from your own client too, as a forward-compatibility signal.

Query parameters

None.

Example request

curl https://api.opto-soft.com/api/quickSale/app-version \
  -H "Authorization: Bearer YOUR_TOKEN"
Chat with us Call us