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

Save a Sale Challan Return

Creates a sale challan return in Logic ERP: goods that a customer sends back after they were delivered on a sale challan (for example goods on approval that were not kept). The return is saved as a challan in a challan-return series, and the goods come back into your branch's stock. Like a challan, it is not a sale document: no sale return or credit note is raised until the return is converted into a sale return.

Endpoint

Name
Detail

Address

https://your-server/api/SaveSaleChallanReturn

Method

POST

Authorization

Basic Auth

Also accepted: https://your-server/api/SaveInvoice with "Doc_Type": "CHR" in the request – it is handled exactly like this endpoint.

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

Send one return per request. Field names are matched without regard to upper/lower case; fields not listed below are ignored. Always send TenderDetails as [] or leave it out – null makes the request fail – and do not send null for LogicUserCode or AddlItemCode.

  • This endpoint takes no reference to the original challan. The return is tied to the customer (PartyUserCode), not to a particular challan, and the goods are received into a lot of the item that Logic ERP picks (see the rules). Send the same party as on the challan.

  • The return's own number is returned in Invoice_No, and its internal number in LastSavedCode.

  • To raise the sale return (credit note) for the goods later, send that LastSavedCode as Doc_Code to Save a Sale Return Against a Sale Challan Return. A return saved by mistake can be cancelled with Cancel a Sale Challan Return.

How it differs from Save a Sale Invoice

Compared with Save a Sale Invoice, which sells goods and books the sale:

  • Stock comes in instead of going out, and stock on hand is never checked.

  • The document goes into a challan series marked for challan returns; BillSeries cannot be left empty unless your API site has a default series for this endpoint.

  • Lines of the same item at the same rate are combined into one line.

  • TenderDetails, BillingAddress and ShippingAddress are ignored, and no TCS is worked out. Token_No is accepted.

  • With your API site's "order number" setting on, OrderNo must be unique among the challan returns of the party.

Request fields

Field
Type
Required
Default
Meaning

BranchCode

number

No

0

The branch receiving the goods, by Logic ERP's branch number (Branch_Code in Get Branch Info).

BranchShortName

text

No

empty

The branch by its short name; used only when BranchCode is 0. With neither, Logic ERP falls back to a default branch – always send one.

PartyUserCode

text

Yes

–

The customer's party code (User_Code in Get Party Master). Must already exist.

BillSeries

text

Yes*

–

Name of a challan series marked for challan returns in that branch. *May be left out only when your API site has a default series for this endpoint. If the name is not found, the party-linked or default series is used – see the rules.

Bill_Number

number

No

0

A fixed number in BillSeries. 0 = next number. See the known issue on duplicate numbers.

Bill_Date

date

No

today

Date of the return, yyyy-MM-dd; it also decides the financial year. A value that is not a date is ignored (today is used).

Ext_Bill_No

text

No

empty

Your own document number; saved as the return's document number and returned in Invoice_No.

OrderNo

text

No*

empty

Your return reference / the customer's order number. *Required and unique per party when your API site's order number setting is on. Also used to find the lot (see the rules). Returned in PartyOrderNo.

OrderDate

date

No

empty

Date of that order.

Order_Id

text

No

empty

A further reference; filled from OrderNo when your API site is set to copy it.

Token_No

text

No

empty

A token number stored on the return.

Sale_BillNo, Sale_Bill_Date

text, date

No

empty

A reference bill number and date, for example the customer's return note.

Challan_No, Challan_Date

text, date

No

empty

A reference challan number and date (for example the original challan number, as text). Stored only – not used to link anything.

Godown_Name

text

No

empty

Godown the goods come back into, by name. Must exist. Used when your API site has no default godown for returns.

PaymentMode

text

No

credit

CASH or CREDIT, in capitals. CASH saves the return in cash mode, with the series' default customer as customer.

ActEntryPartyUserCode

text

No

the party

A different party code for the accounting entry. Must exist.

AgentName, TransporterName, Tax_Form_Name, CostCenter

text

No

defaults

Agent, transporter, tax form and cost centre by name. Each must exist. The transporter defaults to the party's.

TransportMode, GRNo, GRDate

text, text, date

No

empty

Transport mode, LR / GR number and date.

WayBillNo

text

No

empty

See the known issue – do not send it.

Tax_Region

text

No

party, else series default

Tax region by its name in Logic ERP. Must exist.

GST_State_Code

text

No

empty

GST state code stored on the return.

CurrencyName, ExchangeRate

text, number

No

empty, 0

Foreign currency by name, with its rate (more than 0).

CreditDays

number

No

Logic ERP's default

Used when more than 0.

DeliveryAt, DeliveryAdd1, DeliveryAdd2, Cases, Weight, PVTMark, Insurance_Policy_No

text

No

empty

Delivery and packing details.

Remarks1, Remarks2, Remarks3

text

No

series default remarks

Remarks.

Declaration_No, DeclarationNo

text

No

empty

Declaration number (Declaration_No wins when both are sent).

CD_P, TD_P, SpCD_P

number

No

0

Return-level CD %, TD % and special CD %; used when more than 0, and for every line without its own.

Freight, Handling, SpDiscountRs, Adjustment_Rs

number

No

0

Amounts in ₹; used when more than 0.

Ext_NetSale_Value

number

No

0

If not 0, Logic ERP's net amount must equal it exactly, or nothing is saved.

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, Billing_Address1, Billing_Address2

text (RCU_Mem_Number number)

No

empty

A retail customer for the return – found or created as described in the rules.

LstItems

list

Yes

–

The items returned. See below.

DisplayError

text

No

"0"

"1" = full technical error text in Message when something fails.

Request_ID

text

No

empty

Only for API sites set to store requests for later processing. Otherwise ignored.

TenderDetails, BillingAddress, ShippingAddress, Doc_Type, Doc_Code, STBranchCode, InvoiceType, EntrySource

–

No

–

Ignored by this endpoint (but see the note on a null TenderDetails).

LstItems

Field
Type
Required
Default
Meaning

LogicUserCode

text

Yes, or AddlItemCode

empty

The item code shown in Logic ERP (UserCode in Get Item Master).

AddlItemCode

text

Yes, or LogicUserCode

empty

The item's additional code / barcode. Used when LogicUserCode is empty or not found.

Quantity

number

Yes

–

Quantity returned; more than 0.

Rate

number

No

rate from the series' price list

Rate per unit in ₹; used when more than 0. See the known issue on mixing lines with and without a rate.

Mrp

number

No

the lot's MRP

Used when more than 0.

Lot_No

text

No*

empty

Lot (batch) number of the goods returned. If filled, it must exist for the item. *Used to choose the lot only when your API site requires lot numbers on returns – see the rules.

CD_P, TD_P

number

No

return-level value

Line CD % and TD %; used when more than 0.

SPCD_P

number

No

return-level value

Line special CD %. See the known issue – applied only when Mrp is also sent.

Scheme_Rs, AdjustItem_Rs

number

No

0

Scheme discount and rate adjustment in ₹ for the line; used when more than 0.

ItemDescription

text

No

empty

Description printed for the line.

SchemePerUnit, LabourPerUnit, AdjustmentPerUnit, AdjustmentRs, GodownName, Production_Unit, SaleOrSR

–

No

–

Ignored by this endpoint.

Rules Logic ERP applies

Party, branch, series

  • The party is found by its code exactly as sent. A party locked for billing is refused.

  • The branch is BranchCode, else BranchShortName; the financial year comes from Bill_Date.

  • BillSeries must be a challan series of the branch that is marked for challan returns. Left empty, the request fails unless your API site has a default series. If the name is not found, Logic ERP silently uses the challan series linked to the party (even one not marked for challan returns), then the default series – check Invoice_No in the answer.

Lines and lots

  • Lines of the same item at the same Rate are combined into one line with the total quantity. The lot number, description and MRP of the first such line are kept; the discounts of the last one are used.

  • Lot of the returned goods.

    • If your API site is set to require lot numbers on returns, Logic ERP looks the lot up for each line: first among lots sold on sale invoices with this OrderNo (this financial year: this branch first, then any branch), then by Lot_No for the item (this year and branch, then this branch, then this year). An empty Lot_No takes the most recent lot of the item. No lot found stops the request.

    • Otherwise Lot_No is only checked to exist; Logic ERP receives the goods into a lot of the item it picks itself. The item must have at least one lot in Logic ERP (it must have been purchased or received before).

  • Stock on hand is not checked on a return. The goods go into the default return godown set in your API site, else Godown_Name.

  • Rate, Mrp and the discounts you send are used when more than 0; otherwise the series' price list and item defaults apply. Schemes are applied, then totals and taxes from the tax region: Tax_Region when sent, otherwise the party's (for this branch, else its own), otherwise the series default.

Order number

  • With your API site's "order number" setting on, OrderNo is required and must not already be used on another challan return of the same party in the same branch. It is checked again while saving.

Retail customer

  • If RCU_Mem_Number, RCU_Mobile_No or RCU_Email is filled, the return is linked to a retail customer, found by membership series + number or by mobile number, and created from the RCU_ fields if not found. RCU_Mem_Prefix, RCU_Mobile_No and RCU_First_Name are then required.

Saving

  • The return is saved in one step; on any failure nothing is saved (a retail customer created on the way is kept).

  • If your API site is set to save in the background, the answer comes back at once with Status: false, an empty Message and a request_ID; look the result up by that ID with the TokenStatus endpoint.

  • If your API site only stores requests for later processing, the answer is Request is pending for processing... with Status: false – stored, not refused.

Known issue – mixing lines with and without Rate. When at least one line has a Rate above 0, a line sent with Rate 0 cannot be matched after Logic ERP prices it, and the request fails with Stock not available for Item Code : … although stock is not checked on a return. Send a Rate on every line, or on none.

Known issue – line SPCD_P. A line's special CD % is applied only when the same line also has an Mrp above 0. Send Mrp with SPCD_P, or use the return-level SpCD_P.

Known issue – WayBillNo. A way bill is never linked, and a way bill that is not finalised is refused with Way Bill No. :… is already Finalized..Please Check. Leave WayBillNo out.

Known issue – duplicate numbers. With Bill_Number, the "already exists" check looks at sale invoices, not challans, so a number already used in the challan-return series is not caught by it. Leave Bill_Number at 0.

Known issue – an apostrophe in a code or name. Codes and names you send (party code, series, lot number, order number, tax region, godown, agent, transporter, cost centre, currency and so on) are looked up exactly as typed. An apostrophe (') in any of them, for example D'SOUZA, makes the request fail with a database error. Leave apostrophes out of codes and names you send.

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. The example takes back one pair of the test item APITEST0001 and sends Tax_Region because the test customer has none; each send creates one more test challan return.

Save a Sale Challan Return

post

Creates a sale challan return in Logic ERP: goods that a customer sends back after they were delivered on a sale challan (for example goods on approval that were not kept). The return is saved as a challan in a challan-return series, and the goods come back into your branch's stock. Like a challan, it is not a sale document: no sale return or credit note is raised until the return is converted into a sale return.

Authorizations
AuthorizationstringRequired

The user name and password of your API site.

Body
BranchCodeintegerOptional

The branch receiving the goods, by Logic ERP's branch number (Branch_Code in Get Branch Info).

PartyUserCodestringOptional

The customer's party code (User_Code in Get Party Master). Must already exist.

BillSeriesstringOptional

Name of a challan series marked for challan returns in that branch. *May be left out only when your API site has a default series for this endpoint. If the name is not found, the party-linked or default series is used – see the rules.

Bill_DatestringOptional

Date of the return, yyyy-MM-dd; it also decides the financial year. A value that is not a date is ignored (today is used).

OrderNostringOptional

Your return reference / the customer's order number. *Required and unique per party when your API site's order number setting is on. Also used to find the lot (see the rules). Returned in PartyOrderNo.

Remarks1stringOptional

Remarks.

Tax_RegionstringOptional

Tax region by its name in Logic ERP. Must exist.

Responses
200

Always HTTP 200. Check Status and Message.

application/json
PrintFilestringOptional

Always empty.

Invoice_NostringOptional

The number given, for example CHRT-37, or your Ext_Bill_No.

Order_NostringOptional

Always empty for this endpoint.

PartyOrderNostringOptional

The OrderNo you sent.

StatusbooleanOptional

true = the return was saved.

MessagestringOptional

Why it failed. On success it is empty – or, if your API user's Logic ERP rights show the document number after saving, text such as Saved Doc No. - CHRT-37 followed by Doc Date - 30/10/2026 on a new line.

LastSavedCodeintegerOptional

Logic ERP's internal number of the challan return. Send it as Doc_Code to raise the sale return against it, or use it to cancel the return.

request_IDstringOptional

The ID of this request – quote it to support.

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

{
  "BranchCode": 2,
  "PartyUserCode": "APITESTC01",
  "BillSeries": "CHR",
  "Bill_Date": "2026-10-30",
  "OrderNo": "APITEST-CR-001",
  "Remarks1": "API TEST",
  "Tax_Region": "CGST/SGST",
  "LstItems": [
    {
      "LogicUserCode": "APITEST0001",
      "Quantity": 1,
      "Rate": 3099
    }
  ]
}
{
  "PrintFile": "text",
  "Invoice_No": "text",
  "Order_No": "text",
  "PartyOrderNo": "text",
  "Status": true,
  "Message": "text",
  "LastSavedCode": 1,
  "request_ID": "text"
}

Response

Field
Type
Meaning

Status

true / false

true = the return was saved.

Message

text

Why it failed. On success it is empty – or, if your API user's Logic ERP rights show the document number after saving, text such as Saved Doc No. - CHRT-37 followed by Doc Date - 30/10/2026 on a new line.

LastSavedCode

number

Logic ERP's internal number of the challan return. Send it as Doc_Code to raise the sale return against it, or use it to cancel the return.

request_ID

text

The ID of this request – quote it to support.

Invoice_No

text

The number given, for example CHRT-37, or your Ext_Bill_No.

PartyOrderNo

text

The OrderNo you sent.

Order_No

text

Always empty for this endpoint.

PrintFile

text

Always empty.

Example response

Messages you may see

All with Status: false. Text in … is replaced by the value concerned. Where the reason comes from an error inside Logic ERP it may be followed by technical detail – read the first line.

Message
Meaning
What to do

Party GST State and Company/Branch GST State cannot be same for IGST. Please check.

The tax region used (the party's, else the series default) is an IGST region, but the party is in the branch's own GST state.

Send Tax_Region with the right region (for example CGST/SGST), or set the party's tax region in Logic ERP.

Party Code Not Set in API Request for Sale Return...

PartyUserCode is empty.

Send the party code.

Unable to Retrieve Accounts...

No account has that party code.

Send an existing party code.

Bill Series Cannot be blank...

No BillSeries and no default series for this endpoint.

Send a challan-return series.

Bill Series : … Not found for Branch Code :… in API Parameter.., Default Bill Series Not Set for Branch Code :…

No usable series was found.

Send a challan series of the branch that is marked for challan returns.

Cannot allow Bill Saving If Bill Number defined without Bill Series....

Bill_Number without BillSeries.

Send both, or neither.

No Item Present..

LstItems is empty or missing.

Send at least one line.

Invalid Item Qty : … for Item Code : … EAN Code : …

A quantity of 0 or less.

Send a positive quantity.

Invalid LogicUserCode / EANCode : …, LogicUserCode Or EAN Code Cannot Blank!!

Unknown item code, or a line with no code.

Check the code with Get Item Master.

Unable to found LotNo : … againts EAN/Item Code : …

Lot_No does not exist for the item.

Send an existing lot number, or leave it out.

Lot Number : '…' for Item : '…' not found..

Lot numbers are required on returns and no lot was found.

Send the lot number of the goods sold.

Stock not available for Item Code : … Quantity : … Search Key : …

The item has no lot in Logic ERP, or the line could not be matched (see the known issue on Rate).

Check the item and the rates.

Unable to Save Bill for Item Code : … Quantity : … and Billing Qty : … due to Stock not available., Unable to Save Invoice for Item Code : … Org Quantity : … (followed by Stock In Hand : … on a new line)

The quantity picked up for an item differs from what you sent.

Check the item and quantity; contact support with the request_ID.

Order No. Cannot be blank...., Order No. already exists for same Customer.Please Check

The order number setting is on and OrderNo is empty or already used on a challan return of this party.

Send a new OrderNo.

Invalid Godown Name [….]. Please Check...

Godown_Name not found.

Use a godown name from Logic ERP.

Unable to found Tax Region : …, Invalid Agent [….] .Please Check, Invalid Tax Form [….] .Please Check, Unable to found Cost Center [….] .Please Check, Transporter Name [ … ] not found. Please Check..., Unable to found A/E Party : …

A name or code sent does not exist in Logic ERP.

Use the value exactly as in Logic ERP.

Currency Name : … not found...Please Check..., Exchange Rate not Defined for Currency Name :…...Please Check...

Unknown currency, or no rate.

Fix the currency fields.

Way Bill No. :… not found In Branch Code : …, Way Bill No. :… is already Finalized..Please Check

See the known issue.

Leave WayBillNo out.

Sale Bill Locked against Party(Setup New Accounts)

Billing is blocked for this party.

Ask the Logic ERP user to unblock the party.

Net Value cannot match with External Net Value...

Ext_NetSale_Value differs from Logic ERP's net amount.

Check rates and discounts, or send 0.

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

Retail-customer details are incomplete.

Complete the RCU_ fields, or leave them all empty.

Request is pending for processing...

Your API site stores requests for later processing.

Not an error: keep the request_ID.

If your API site uses the newer save routine

Your Logic ERP team can switch this endpoint to a newer save routine. It takes the same request, with these differences:

  • The financial year is taken from Sale_Bill_Date (today when empty); the return is still dated Bill_Date. Send both with the same date.

  • Lines are kept as sent (not combined), and every line field, including SchemePerUnit, LabourPerUnit, AdjustmentPerUnit and AdjustmentRs, is used.

  • The lot is always looked up – by OrderNo on sale invoices, then by Lot_No – and the goods go into the godown of that lot unless a default return godown applies. With lot numbers required on returns, an empty Lot_No fails with Invalid Lot Nummber In request Payload...; a lot not found fails with Unable to find available stock/lot for Item Code : ….

  • BillSeries may be empty when a default series exists; the party-linked series is not used. Bill_Number and Request_ID are ignored, and nothing is saved in the background.

  • Other messages: Unable to found PartyUserCode : …, Party_User_Code cannot be blank..., No Item Found!!, Unable to find Item. Logic User Code : …, Quantity cannot be blank. Logic User Code : …, Entry/Modification is locked for this period...., Unable to Save Sale Bill....

Last updated