For the complete documentation index, see llms.txt. This page is also available as Markdown.

Save a Sale Order

Creates a sale order in Logic ERP from your shop, website or marketplace: the customer account, the items and quantities, and optionally rates, discounts, delivery dates, billing and shipping addresses, a retail customer and an advance the customer has paid. Logic ERP gives the order its number in the order prefix you send, works out GST and other taxes for the order's tax region, fills in rates from its price list where you send none, and records any advance as a receipt against the order. The answer tells you the order number and Logic ERP's internal number of the order, which you need to cancel it later with Cancel a Sale Order.

Endpoint

Name
Detail

Address

https://your-server/api/SaveSaleOrder

Method

POST

Authorization

Basic Auth

Also accepted: https://your-server/api/SaveSaleOrderAsync. It takes the same request, runs the same save and gives the same answer; despite its name it does not answer early. The only difference: when request queueing is switched on for your API site, SaveSaleOrder queues orders branch by branch, while SaveSaleOrderAsync puts the orders of all branches in one queue.

The response envelope, branches, dates and the common messages are explained in How Every API Call Works.

Send one order per request. Field names are matched without regard to upper/lower case. Fields not listed below are ignored. Do not send null for ListItems, AdvanceEntry, LogicUser_Code or AddlItemCode: send "" (or [], {}) or leave the field out. Otherwise the request fails with a technical error.

Two save routines

Logic ERP has two routines that can save this endpoint. A setting of your API site decides which one runs. Your Logic ERP support team can tell you which one your site uses.

  • The standard routine is used unless your site is switched to the newer one. Everything on this page up to the section If your API site uses the newer save routine describes it.

  • The newer routine fills in Logic ERP's sale order screen for you, so the screen's own checks and defaults apply. The fields are the same, but several behave differently. See the section at the end.

The site settings delivered with the API switch this endpoint to the newer routine, so do not assume the standard one – ask.

You can usually tell them apart by a failed answer: the standard routine starts Message with Warning Message : (unless technical detail is switched on, see DisplayError), the newer routine always starts it with technical text.

Request fields

Field
Type
Required
Default
Meaning

Branch_Code

number

Yes (or Branch_Short_Name)

0

The branch taking the order (Branch_Code in Get Branch Info). Order numbers run per branch. With 0 and no short name the order is saved without a real branch. A negative number is refused.

Branch_Short_Name

text

No

empty

The branch by its short name. Used only when Branch_Code is 0.

Order_Prefix

text

Yes

–

The order prefix, for example "WEB". The order is numbered WEB-1, WEB-2 … within the branch. Any text is accepted; only the first 15 characters are kept.

Order_Date

date

No

today

The order date, yyyy-MM-dd. It also decides the financial year.

Party_User_Code

text

Yes

–

The customer account: its user code in Logic ERP, as in Get Party Master. A supplier account is also accepted.

Party_Order_No

text

Depends on the configuration

empty

Your own order number (up to 100 characters). Stored on the order and returned as Order_No. When the sale order configuration demands it, it is required and must not already be used for the same customer in the branch (see the rules).

Party_Order_Date

date

No

–

The date of your order.

External_Order_ID

text

No

empty

Another reference of yours, stored on the order.

Remarks

text

No

empty

Remarks for the order.

Tax_Region

text

No

the customer's

The tax region by its exact name in Logic ERP, for example "Local". See the rules for how the tax region is chosen.

Payment_Method

text

No

empty

"COD" (exactly, in capitals) marks the order as cash on delivery. Any other value – also "cod" – or none marks it as not cash on delivery.

Delivery_Date

date

No

–

The delivery date of the order. Also used as the "deliver not before" date, and as the delivery date of each line that has none.

Delivery_Time

text

No

–

The delivery time, for example "16:30". Used only together with a valid Delivery_Date.

Exfactory_Date

date

No

–

The ex-factory date of each line that has none.

Agent_Name

text

No

empty

The agent, by the exact agent name in Logic ERP. "(NIL)" or empty = no agent. The customer's default agent is not used: leave it out and the order has no agent.

Company_Name

text

No

empty

A company (brand) by its exact name in Logic ERP. "(NIL)" = none.

Transport_Name

text

No

empty

The transporter by its exact name in Logic ERP. "(NIL)" = none.

Order_Type

text

No

empty

An order type set up in Logic ERP, by its exact name. "(NIL)" = none.

Indirect_Customer_User_Code

text

No

empty

The user code of an indirect customer (a customer or supplier account, or an account marked as also a customer).

Indirect_Order_No, Indirect_Order_Date

text, date

No

–

The indirect customer's order number and date.

Branch_Order_Date

date

No

–

Stored on the order.

Doc_Through

text

No

empty

Stored on the order. "B2B" makes the order a business order: RCU_GST_No is then required (see the rules).

Delv_Vessel_Fight_No

text

No

empty

Vessel or flight number of the delivery.

Total_Other_Val_1 … Total_Other_Val_7

number

No

0

The order's other values 1 to 7, as set up in the sale order configuration (for example freight).

RCU_Mem_Prefix, RCU_Mem_Number, RCU_Mobile_No, RCU_Email, RCU_First_Name, RCU_Last_Name, RCU_City, RCU_State, RCU_Country, RCU_PinCode, RCU_GST_No

text

No

empty

The retail customer (end customer) of the order: membership series and number, mobile, e-mail, name, city, state, country, PIN code and GST number. See Retail customer in the rules.

Billing_Address1, Billing_Address2, Billing_City, Billing_State, Billing_Country, Billing_PinCode, Billing_MobileNo, Billing_EmailID, Billing_ContactPerson, Billing_Location

text

No

empty

The billing address of the order. See Addresses in the rules.

Shipping_Address1 … Shipping_Location

text

No

empty

The shipping address, with the same fields as the billing address.

Billing_FirstName, Billing_MiddleName, Billing_LastName, Shipping_FirstName, Shipping_MiddleName, Shipping_LastName

text

No

empty

Not stored. Filling one of them only makes Logic ERP save an address. Put the name in …_ContactPerson.

AdvanceEntry

object

No

–

An advance the customer has paid. See the table below.

ListItems

list

Yes

–

The order lines. See the table below.

DisplayError

text

No

"0"

"1" = when the save fails, Message carries the full technical detail instead of the short reason. When your API site keeps a request log, you get the technical detail even without it.

ValidateOnly, ActEntryPartyUserCode

–

–

–

Ignored.

Request fields – ListItems

Field
Type
Required
Default
Meaning

LogicUser_Code

text

Yes (or AddlItemCode)

empty

The item's code in Logic ERP, as in Get Item Master.

AddlItemCode

text

Yes (or LogicUser_Code)

empty

The item's additional code (for example its EAN barcode). Used when LogicUser_Code is empty or not found.

Order_Qty

number

Yes

–

Quantity ordered. Must be above 0.

Rate

number

No

price list

Rate per unit in ₹. 0 or left out = the rate Logic ERP takes from the price list or item rates set in the sale order configuration.

Mrp

number

No

item's MRP

The MRP. Used only when above 0; otherwise the MRP of the item in Logic ERP.

CD_P

number

No

0

Cash discount %.

TD_P

number

No

0

Trade discount %.

SPCD_P

number

No

0

Special discount %.

CD_Rs

number

No

0

Cash discount amount in ₹ for the line.

Scheme_Item

number

No

0

Scheme amount in ₹ for the line.

Adjust_Item

number

No

0

Adjustment amount in ₹ for the line.

Tax_Amount

number

No

0

Despite its name, a tax rate in %. Used only when Logic ERP finds no tax for the item in the order's tax region; otherwise Logic ERP's own tax rate is used.

Remarks

text

No

empty

Remarks for the line.

User_Column_1 … User_Column_5

text

No

empty

Your own values for the line (up to 50 characters each). User_Column_2 can later be used to cancel this line.

Item_Order_ID

text

No

empty

Your own ID of the line (up to 50 characters). Use it to cancel the line later.

Exfactory_Date, Delivery_Date

date

No

the order's

The line's ex-factory and delivery dates.

Lot_Number

text

No

empty

A lot number stored on the line (up to 25 characters).

ItemDetCode is not accepted in the request.

Request fields – AdvanceEntry

Field
Type
Required
Default
Meaning

CashAmount

number

No

0

Advance received in cash, in ₹.

CreditCardAmount

number

No

0

Advance received by card, in ₹.

CreditCardNo

text

No

–

The card number or reference for the card advance.

ChequeAmount

number

No

0

Advance received by cheque, in ₹.

ChequeNo

text

No

–

Cheque number.

ChequeDate

date

No

–

Cheque date, yyyy-MM-dd.

CreditNoteAmount

number

No

0

Amount adjusted from the customer's credit note, in ₹.

Rules Logic ERP applies

Before anything is saved

  • Your API site must have a default sale order configuration chosen in its API settings; it decides numbering checks, rates, discounts, taxes and advances. Without it, every request fails with Default Sale Order Configuration Not Selected!!.

  • The customer is found by Party_User_Code among customer and supplier accounts. Lookups by name (Agent_Name, Company_Name, Transport_Name, Order_Type, Tax_Region) need the exact name as stored in Logic ERP.

  • Each line's item is looked up by LogicUser_Code; if that is empty or not found, by AddlItemCode; with only AddlItemCode, also among the item's extra barcodes. An item that is not found stops the whole request.

  • The order date may not be later than today, unless your API user is allowed post-dated sale orders. It may not be in a period that is locked for entry, or on or before the lock date for changes.

  • All of the following happen together, or none of them: a failure part-way undoes the order, its addresses, the retail customer and the advance entries.

Numbering and the answer

  • The order number is the prefix, a hyphen and the next free number for that prefix in the branch, for example WEB-205. It is returned in LastSavedDocNo.

  • Your API site can be set to skip lines whose LogicUser_Code is "-1". When no line is left, the request fails with No Item Found....

Your order number

  • When the sale order configuration requires a party order number, Party_Order_No must be filled, and an order of the same customer in the same branch with the same Party_Order_No must not exist (cancelled orders included). A repeated order is refused with Party Order No. already exists for same Customer.Please Check, ErrorCode "210008" and LastSavedCode set to the internal number of the order that already exists, so a retry after a time-out can find its first order.

  • When the configuration does not require it, the same Party_Order_No can be saved again.

Rates, discounts and taxes

  • Lines with Rate 0 get the rate from the price list or item rates chosen in the sale order configuration.

  • The tax region is Tax_Region when sent. Otherwise it is the region linked to the customer for this branch, else the customer's own region, else the default region of the sale order configuration. Taxes are worked out item by item for that region.

  • When the configuration says so, a line whose rate is equal to or above its MRP is refused with Rate cannot be equal or greater than MRP Of Item : ….

  • Discounts, other values and totals are worked out the way the sale order configuration defines.

Known issue – a misspelt Tax_Region is not reported. A tax region name that does not exist is not refused: the order gets the default region of the sale order configuration, or none. Check the name against Logic ERP before you send it.

Retail customer

  • When any RCU_… field other than RCU_GST_No is filled, the order is linked to a retail customer. You must then send RCU_Mobile_No, RCU_First_Name and a membership series (RCU_Mem_Prefix, unless your API site sets a fixed series, which then replaces yours). When Logic ERP identifies customers by e-mail, RCU_Email is also required.

  • With RCU_Mem_Number above 0, the customer is looked up by series and number; otherwise by mobile number. When not found, a new retail customer is created from the RCU_… fields and Billing_Address1 / Billing_Address2; names and places are stored in capitals.

  • RCU_State may be the state's name or short name; when it matches a state in Logic ERP, the country is taken from that state.

  • With "Doc_Through": "B2B", RCU_GST_No is required, and the retail customer is also given a customer account in Logic ERP (created when it has none), which becomes the order's indirect customer.

Known issue – a fixed membership series makes the retail customer compulsory. When your API site sets a fixed membership series, every order is treated as having a retail customer, even when you send no RCU_… fields. Such orders are refused with Customer First Name not defined...Please Check.. or Mobile Number cannot be blank.... On such a site, always send RCU_Mobile_No and RCU_First_Name.

Addresses

  • Billing and shipping addresses are not used when the customer account is GST-registered; the order is then saved without a separate billing or shipping address.

  • An address is saved only when at least one of its fields is filled. Empty parts are filled in: address and mobile ".", PIN code ".", city "(NIL)".

  • When the state matches a state in Logic ERP (by name or short name), the country is taken from that state. A state that is not found needs a country, or the request fails with Billing address Country name can not be blank... (or Shipping …); the state, and the country if it is new, are then added to Logic ERP's masters. A state that already exists under another country is refused.

  • An address with no state is saved with state "NIL" and country "IN". Send the state.

Advance

  • A cash, card or cheque amount above 0 is recorded as a receipt against the order (cash receipt, or bank receipt for card and cheque), using the receipt set-ups linked to the sale order configuration, in the order's financial year.

  • CreditNoteAmount is adjusted through a journal entry; the sale order configuration must have a credit note account and a journal set-up, or the request fails with Default Credit Note A/c not specified... Please Check. or JV Configuration not linked for Credit Note... Please Check.

After the save

  • When Logic ERP's approval rules require it, the order is saved awaiting approval.

  • The save runs as the Logic ERP user linked to your API site, so that user's rights and locks apply, and the order is recorded in the audit trail.

  • When this endpoint is switched off for your API site, the answer is Status: true with LastSavedCode 0 and Warning Message : Request cannot be processed. API Template is marked as In-Active in the configuration. (or technical text containing it). Nothing was saved. The switch applies to your whole API site, not per branch.

Example request

Test it

Send a request to the Logic ERP sandbox (a test company) from this page: open the block below, enter the sandbox user name and password (ask your Logic ERP support team), change the request if you like, and press Test it. This really saves in the sandbox, so use test values like the example. Each send creates one more test sale order for the sandbox's test customer APITESTC01; change Party_Order_No each time, because a repeated party order number is refused.

Save a Sale Order

post

Creates a sale order in Logic ERP from your shop, website or marketplace: the customer account, the items and quantities, and optionally rates, discounts, delivery dates, billing and shipping addresses, a retail customer and an advance the customer has paid. Logic ERP gives the order its number in the order prefix you send, works out GST and other taxes for the order's tax region, fills in rates from its price list where you send none, and records any advance as a receipt against the order. The answer tells you the order number and Logic ERP's internal number of the order, which you need to cancel it later with Cancel a Sale Order.

Authorizations
AuthorizationstringRequired

The user name and password of your API site.

Body
Branch_CodeintegerOptional

The branch taking the order (Branch_Code in Get Branch Info). Order numbers run per branch. With 0 and no short name the order is saved without a real branch. A negative number is refused.

Order_PrefixstringOptional

The order prefix, for example "WEB". The order is numbered WEB-1, WEB-2 … within the branch. Any text is accepted; only the first 15 characters are kept.

Order_DatestringOptional

The order date, yyyy-MM-dd. It also decides the financial year.

Party_User_CodestringOptional

The customer account: its user code in Logic ERP, as in Get Party Master. A supplier account is also accepted.

Party_Order_NostringOptional

Your own order number (up to 100 characters). Stored on the order and returned as Order_No. When the sale order configuration demands it, it is required and must not already be used for the same customer in the branch (see the rules).

Party_Order_DatestringOptional

The date of your order.

RemarksstringOptional

Remarks for the order.

RCU_Mem_PrefixstringOptional

The retail customer (end customer) of the order: membership series and number, mobile, e-mail, name, city, state, country, PIN code and GST number. See Retail customer in the rules.

RCU_Mobile_NostringOptional

The retail customer (end customer) of the order: membership series and number, mobile, e-mail, name, city, state, country, PIN code and GST number. See Retail customer in the rules.

RCU_First_NamestringOptional

The retail customer (end customer) of the order: membership series and number, mobile, e-mail, name, city, state, country, PIN code and GST number. See Retail customer in the rules.

RCU_Last_NamestringOptional

The retail customer (end customer) of the order: membership series and number, mobile, e-mail, name, city, state, country, PIN code and GST number. See Retail customer in the rules.

Responses
200

Always HTTP 200. Check Status and Message.

application/json
LastSavedDocNostringOptional

The order number, for example "WEB-205". null when the save failed.

Order_NostringOptional

Your Party_Order_No, returned as sent – not Logic ERP's order number. null when the save failed.

ErrorCodestringOptional

A code for some failures: "210001" customer not found, "210002" indirect customer not found, "210003" agent, "210004" company, "210005" transporter, "210006" order type not found, "210007" quantity missing, "210008" party order number already used, "210009" party order number missing, "10001" item not found. Empty or null otherwise.

StatusbooleanOptional

true when the order was saved. Also true when the endpoint is switched off for your API site – then LastSavedCode is 0.

MessagestringOptional

Empty when saved. Otherwise Warning Message : followed by the reason, or technical text (see DisplayError).

LastSavedCodeintegerOptional

Logic ERP's internal number of the order. Keep it to cancel the order. 0 when the save failed, except for a repeated party order number (see the rules).

request_IDstringOptional

As described on the common page.

post/SaveSaleOrder
POST /api/SaveSaleOrder HTTP/1.1
Host: demo.logicerp.com
Authorization: Basic username:password
Content-Type: application/json
Accept: */*
Content-Length: 401

{
  "Branch_Code": 2,
  "Order_Prefix": "APITEST",
  "Order_Date": "2026-10-30",
  "Party_User_Code": "APITESTC01",
  "Party_Order_No": "APITEST-SO-001",
  "Party_Order_Date": "2026-10-30",
  "Remarks": "API TEST",
  "RCU_Mem_Prefix": "APITEST",
  "RCU_Mobile_No": "9123400001",
  "RCU_First_Name": "APITEST",
  "RCU_Last_Name": "API TEST",
  "ListItems": [
    {
      "LogicUser_Code": "APITEST0001",
      "Order_Qty": 2,
      "Rate": 0,
      "Item_Order_ID": "APITEST-SO-001-1"
    }
  ]
}
{
  "LastSavedDocNo": "text",
  "Order_No": "text",
  "ErrorCode": "text",
  "Status": true,
  "Message": "text",
  "LastSavedCode": 1,
  "request_ID": "text"
}

Response

Field
Type
Meaning

Status

true / false

true when the order was saved. Also true when the endpoint is switched off for your API site – then LastSavedCode is 0.

Message

text

Empty when saved. Otherwise Warning Message : followed by the reason, or technical text (see DisplayError).

LastSavedCode

number

Logic ERP's internal number of the order. Keep it to cancel the order. 0 when the save failed, except for a repeated party order number (see the rules).

LastSavedDocNo

text

The order number, for example "WEB-205". null when the save failed.

Order_No

text

Your Party_Order_No, returned as sent – not Logic ERP's order number. null when the save failed.

ErrorCode

text

A code for some failures: "210001" customer not found, "210002" indirect customer not found, "210003" agent, "210004" company, "210005" transporter, "210006" order type not found, "210007" quantity missing, "210008" party order number already used, "210009" party order number missing, "10001" item not found. Empty or null otherwise.

request_ID

text

As described on the common page.

Example response

Messages you may see

Every failure message of the standard routine starts with Warning Message : ; the table shows what follows. With "DisplayError": "1", or when your API site keeps a request log, you get technical detail instead – read the first line.

Message
Meaning
What to do

Default Sale Order Configuration Not Selected!!

Your API site has no sale order configuration chosen.

Ask your Logic ERP support team.

Invalid Sale Order Configuration Selected...

The chosen configuration no longer exists.

Ask your Logic ERP support team.

Invalid Party User Code...

No customer or supplier account has that user code.

Check Party_User_Code.

Sale Order Order_Prefix not Set...

Order_Prefix is empty.

Send a prefix.

Invalid Indirect Customer User Code Selected..., Invalid Agent Name..., Invalid Company Name..., Invalid Transport Name..., Invalid Order Type

The name or code is not in Logic ERP.

Send the exact name, or leave the field out.

Invalid Branch Code : …. Please Check...

Branch_Code is negative.

Send a branch from Get Branch Info.

LogicUserCode Or EAN Code Cannot Blank!!

A line has neither item code.

Fill LogicUser_Code or AddlItemCode.

Invalid LogicUserCode / EANCode : …

An item was not found.

Check the item codes.

Quantity cannot be blank. Logic User Code : …

A line has Order_Qty 0 or less.

Send the quantity.

No Item Found...

No line is left to save.

Send at least one line.

Party Order No. Cannot be blank.Please Check

The configuration requires Party_Order_No.

Send it.

Party Order No. already exists for same Customer.Please Check

This customer already has an order with that number in the branch. LastSavedCode holds that order's internal number.

Do not send the order again.

Post Dated enteries are not allowed.......

Order_Date is later than today.

Send today's date or earlier.

Entry/Modification is locked for this period...., Modification rights not available for this date.....

The order date is in a locked period, or on or before the lock date.

Ask your Logic ERP team.

Cannot Allow Entry W/O RCU_GST_No. for B2B Order.

Doc_Through is "B2B" and RCU_GST_No is empty.

Send the GST number.

Mobile Number cannot be blank..., EMail id cannot be blank..., Please Define Mobile No. to Continue..., Please Define Customer Membership Series to Continue..., Customer First Name not defined...Please Check..

A retail customer field is filled but the customer is incomplete.

Complete the RCU_… fields, or send none of them.

Rate cannot be equal or greater than MRP Of Item : …

The configuration does not allow a rate at or above MRP.

Check the rate and MRP.

Billing address Country name can not be blank..., Shipping address Country name can not be blank...

The state was not found in Logic ERP and no country was sent.

Send a known state, or the country.

… already exist against country name-…

The state you sent belongs to another country in Logic ERP.

Correct the state or country.

Default Credit Note A/c not specified... Please Check., JV Configuration not linked for Credit Note... Please Check.

CreditNoteAmount was sent but the configuration is not set up for it.

Ask your Logic ERP team, or leave the amount out.

The operation was canceled.

A step of the save was stopped without a reason. Nothing was saved.

Repeat with "DisplayError": "1", or ask support with the request_ID.

Request cannot be processed. API Template is marked as In-Active in the configuration. (with Status: true)

The endpoint is switched off for your API site. Nothing was saved.

Ask your Logic ERP support team.

If your API site uses the newer save routine

The newer routine takes the same request and fills in Logic ERP's sale order screen with it, using the default sale order configuration of your API site. The differences are:

  • Order_Prefix must be sent but is not used. The order is numbered in the prefix the screen offers for the configuration and branch. Read the real number from LastSavedDocNo.

  • Retail customer. The RCU_… fields do not find or create a retail customer. A B2B order is not given an account for its retail customer.

  • Every failure message is technical text with the reason in it, whatever DisplayError says, without Warning Message : in front; ErrorCode is always empty. Some messages differ: Invalid Party / Account... for an unknown customer, GST number is required for B2B orders. Please enter the customer's GST number and try again.. for B2B without RCU_GST_No.

  • "(NIL)" is not accepted for Agent_Name: it is refused as Invalid Agent Name.... Leave the field empty for no agent.

  • The screen's rules apply to items, rates and the order date. The screen's question Want to Save order? is answered Yes; any other message the screen would show stops the request with that text. Always send Order_Date.

  • The repeated-party-order-number check follows the screen; LastSavedCode is not set to the existing order.

  • When the endpoint is switched off for your API site, the answer is also Status: true with LastSavedCode 0, and the reason inside technical text.

Last updated