> For the complete documentation index, see [llms.txt](https://kb.logicerp.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kb.logicerp.com/logic-erp-learning-hub-tutorials-and-best-practices/api-documentation/sale/push/save-a-sale-return.md).

# Save a Sale Return

Records goods a customer has **brought back**: Logic ERP saves a **sale return** for the party, puts the items back into stock, reverses the tax and leaves the return amount as a **credit for the party** that can later be set off against a sale bill. Use it when your shop, website or POS accepts a return. The request has the same shape as [Save a Sale Invoice](https://kb.logicerp.com/logic-erp-learning-hub-tutorials-and-best-practices/api-documentation/sale/push/save-a-sale-invoice.md); this page lists every field the return reads and explains where a return behaves differently.

### **Endpoint**

| Name          | Detail                                          |
| ------------- | ----------------------------------------------- |
| Address       | `https://your-server/api/SaveSaleReturnInvoice` |
| Method        | `POST`                                          |
| Authorization | Basic Auth                                      |

The response envelope, branches, dates, queueing and the common messages are explained in [How Every API Call Works](https://kb.logicerp.com/logic-erp-learning-hub-tutorials-and-best-practices/api-documentation/how-every-api-call-works.md).

### **How a return is linked to the original bill**

There is **no field for the original bill's number or internal code**. A return is matched to the original sale in two ways, both through `OrderNo`:

* **Sale history (when your Logic ERP is set up for it).** If your company or the return series is set to look up the **sale history** in sale returns – the same setting the Sale Return screen uses – Logic ERP searches, for every line, the most recent earlier sale of the same item (or the same lot, depending on that setup) to this party that still has quantity left to return – sales of the current branch first. The search covers this party's bills only (unless your setup searches all parties), the last two financial years (more if your setup says so), the current branch only (unless set to all branches), any day limit set there, and sales dated up to **today** – not up to `Bill_Date`. When you send `OrderNo`, **only sale bills carrying the same order number** are searched. The first match links the return line to that sale line, and – depending on the same setup – the rate, MRP, lot, godown, agent, taxes and retail customer of that sale are copied to the return line, replacing what you sent. A line with no match is saved unlinked, with your values.
* **Lot.** When your API site makes the lot number compulsory for returns (see **Stock**), the lot is looked up first among the sale bills carrying the same `OrderNo`.

So: to link a return to a sale made through the API, send the **same `OrderNo`** you sent with the sale. `Sale_BillNo` and `Sale_Bill_Date` do **not** link anything – see the known issue below.

### **Request fields**

One return per request. Field names are not case-sensitive. Codes and names are looked up without regard to capitals, but spaces around them are not trimmed (only `Tax_Region`, `TransporterName` and the item codes `LogicUserCode` / `AddlItemCode` are trimmed): send them exactly as they appear in Logic ERP. Where a field works exactly as on Save a Sale Invoice, the meaning below is short; see that page for details.

**Return header**

| Field                                                                                                                                                                                | Type         | Required                                       | Default                             | Meaning                                                                                                                                                                                                                                                                                                     |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------ | ---------------------------------------------- | ----------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `BranchCode`                                                                                                                                                                         | number       | No – but always send it (or `BranchShortName`) | `0`                                 | Logic ERP's number of the branch taking the return back (`Branch_Code` in [Get Branch Info](https://kb.logicerp.com/logic-erp-learning-hub-tutorials-and-best-practices/api-documentation/masters/pull/get-branch-info.md)). The stock comes back into this branch and this branch's API settings are used. |
| `BranchShortName`                                                                                                                                                                    | text         | No                                             | empty                               | The branch's short name, used only when `BranchCode` is `0`.                                                                                                                                                                                                                                                |
| `PartyUserCode`                                                                                                                                                                      | text         | Yes                                            | –                                   | The account that returns the goods, by its code in Logic ERP (`User_Code` in [Get Party Master](https://kb.logicerp.com/logic-erp-learning-hub-tutorials-and-best-practices/api-documentation/masters/pull/get-party-master.md)). It must already exist. Usually the same party as on the original sale.    |
| `Bill_Date`                                                                                                                                                                          | date         | No                                             | today                               | The return date, `yyyy-MM-dd`. It decides the **financial year** the return is saved in.                                                                                                                                                                                                                    |
| `BillSeries`                                                                                                                                                                         | text         | No                                             | see rules                           | The name of a **sale return** series of this branch, for example `"ESR"`.                                                                                                                                                                                                                                   |
| `Bill_Number`                                                                                                                                                                        | number       | No                                             | `0`                                 | `0` = next number of the series. Above `0` = used as the return number; needs `BillSeries` and must not be used yet in that series and year.                                                                                                                                                                |
| `Ext_Bill_No`                                                                                                                                                                        | text         | No                                             | empty                               | Your own return number; kept as the displayed return number and returned in `Invoice_No`.                                                                                                                                                                                                                   |
| `OrderNo`                                                                                                                                                                            | text         | No\*                                           | empty                               | Your order or reference number. Send the **original sale's order number** to link the return to that sale (see above). \*Required when your API site does not allow a duplicate order number – see **Duplicates**.                                                                                          |
| `OrderDate`                                                                                                                                                                          | date         | No                                             | none                                | Date of your order, `yyyy-MM-dd`.                                                                                                                                                                                                                                                                           |
| `Order_Id`                                                                                                                                                                           | text         | No                                             | empty                               | A second reference. Your Logic ERP team can set the API site to copy `OrderNo` into it.                                                                                                                                                                                                                     |
| `Token_No`                                                                                                                                                                           | text         | No                                             | empty                               | A token or counter number kept on the return.                                                                                                                                                                                                                                                               |
| `Tax_Region`                                                                                                                                                                         | text         | No                                             | the default of the series and party | The tax region by name, or `"AUTO"` – see **Tax**.                                                                                                                                                                                                                                                          |
| `GST_State_Code`                                                                                                                                                                     | text         | No                                             | Logic ERP's value                   | Place-of-supply state code. Used only when your Logic ERP team has switched on "accept GST state code" for the API site.                                                                                                                                                                                    |
| `PaymentMode`                                                                                                                                                                        | text         | No                                             | the series' setting                 | `"CASH"` or `"CREDIT"`, in capitals – see **Refund or credit**.                                                                                                                                                                                                                                             |
| `Godown_Name`                                                                                                                                                                        | text         | No                                             | see **Stock**                       | The godown the goods go back into, by name, for lines without `GodownName`.                                                                                                                                                                                                                                 |
| `ActEntryPartyUserCode`                                                                                                                                                              | text         | No                                             | `PartyUserCode`                     | A different account to post the return to in the accounts, by its code.                                                                                                                                                                                                                                     |
| `AgentName`                                                                                                                                                                          | text         | No                                             | Logic ERP's default                 | Agent or salesman, by name.                                                                                                                                                                                                                                                                                 |
| `CostCenter`                                                                                                                                                                         | text         | No                                             | none                                | A cost centre, by name.                                                                                                                                                                                                                                                                                     |
| `Tax_Form_Name`                                                                                                                                                                      | text         | No                                             | none                                | A tax form, by name.                                                                                                                                                                                                                                                                                        |
| `TransporterName`                                                                                                                                                                    | text         | No                                             | the party's transporter             | Transporter, by name.                                                                                                                                                                                                                                                                                       |
| `TransportMode`                                                                                                                                                                      | text         | No                                             | empty                               | Mode of transport.                                                                                                                                                                                                                                                                                          |
| `WayBillNo`                                                                                                                                                                          | text         | No                                             | none                                | A way bill of this branch that is not finalized; it is linked to the return. A finalized way bill is refused.                                                                                                                                                                                               |
| `CurrencyName`, `ExchangeRate`                                                                                                                                                       | text, number | No                                             | none                                | A foreign currency by name, and its exchange rate (required with a currency).                                                                                                                                                                                                                               |
| `CreditDays`                                                                                                                                                                         | number       | No                                             | Logic ERP's default                 | Credit days. `0` keeps Logic ERP's default.                                                                                                                                                                                                                                                                 |
| `CD_P`, `TD_P`, `SpCD_P`                                                                                                                                                             | number       | No                                             | `0`                                 | Return-level CD %, TD % and special CD %, used for lines without their own. Only values above `0` are used.                                                                                                                                                                                                 |
| `Freight`, `SpDiscountRs`, `Adjustment_Rs`, `Handling`                                                                                                                               | number       | No                                             | `0`                                 | Freight, special discount, adjustment and handling in ₹. Only values above `0` are used.                                                                                                                                                                                                                    |
| `Ext_NetSale_Value`                                                                                                                                                                  | number       | No                                             | `0`                                 | The return's net amount in your system. When not `0`, the return is refused if Logic ERP's net amount differs.                                                                                                                                                                                              |
| `Remarks1`, `Remarks2`, `Remarks3`                                                                                                                                                   | text         | No                                             | the series' default remarks         | Remarks, for example the reason for the return.                                                                                                                                                                                                                                                             |
| `DeliveryAt`, `DeliveryAdd1`, `DeliveryAdd2`, `Cases`, `Weight`, `PVTMark`, `GRNo`, `GRDate`, `Challan_No`, `Challan_Date`, `Insurance_Policy_No`, `Declaration_No`, `DeclarationNo` |              | No                                             | empty                               | Kept on the return, as on Save a Sale Invoice. When both declaration fields are sent, `Declaration_No` is kept.                                                                                                                                                                                             |
| `Sale_BillNo`, `Sale_Bill_Date`                                                                                                                                                      | text, date   | No                                             | empty                               | Read but **not saved** – see the known issue.                                                                                                                                                                                                                                                               |
| `RCU_…` fields, `Billing_Address1`, `Billing_Address2`                                                                                                                               |              | No                                             |                                     | The retail customer (shopper) – see **Retail customer**.                                                                                                                                                                                                                                                    |
| `LstItems`                                                                                                                                                                           | list         | Yes                                            | –                                   | The items coming back – see below.                                                                                                                                                                                                                                                                          |
| `TenderDetails`                                                                                                                                                                      | list         | No                                             | empty list                          | How the money goes back – see below. Send `[]` (not `null`) when there are none.                                                                                                                                                                                                                            |
| `Request_ID`                                                                                                                                                                         | text         | No                                             | empty                               | Used only when your API site keeps requests for later processing, as on Save a Sale Invoice.                                                                                                                                                                                                                |
| `DisplayError`                                                                                                                                                                       | text         | No                                             | `"0"`                               | `"1"` = when the request fails, `Message` holds the full technical detail. Use only while testing.                                                                                                                                                                                                          |

**Ignored fields.** `Doc_Type` (this endpoint always saves a sale return), `Doc_Code`, `STBranchCode`, `InvoiceType`, `EntrySource`, `BillingAddress` and `ShippingAddress` are accepted but not used for a return.

**Retail customer (`RCU_…` fields)**

| Field                                                    | Type   | Required                                                           | Default | Meaning                                                                                                            |
| -------------------------------------------------------- | ------ | ------------------------------------------------------------------ | ------- | ------------------------------------------------------------------------------------------------------------------ |
| `RCU_Mem_Prefix`                                         | text   | Yes, when `RCU_Mem_Number`, `RCU_Mobile_No` or `RCU_Email` is sent | empty   | Membership series, for example `"RCU"`.                                                                            |
| `RCU_Mem_Number`                                         | number | No                                                                 | `0`     | Membership number. Above `0` = the customer is looked up by series and number; `0` = by mobile number.             |
| `RCU_Mobile_No`                                          | text   | Yes, as above                                                      | empty   | Mobile number.                                                                                                     |
| `RCU_First_Name`                                         | text   | Yes, as above                                                      | empty   | First name.                                                                                                        |
| `RCU_Email`                                              | text   | No                                                                 | empty   | E-mail. Sending it starts the customer look-up (see the rules); it is saved when Logic ERP creates a new customer. |
| `RCU_Last_Name`, `RCU_City`, `RCU_Country`, `RCU_GST_No` | text   | No                                                                 | empty   | Used only when Logic ERP creates a new customer.                                                                   |
| `RCU_State`, `RCU_PinCode`                               | text   | No                                                                 | empty   | Used when creating a customer, and for the look-up without mobile and e-mail described in the rules.               |
| `Billing_Address1`, `Billing_Address2`                   | text   | No                                                                 | empty   | Address lines for a retail customer that Logic ERP creates.                                                        |

**`LstItems` – one entry per line**

| Field                                                                                               | Type   | Required                 | Default            | Meaning                                                                                                                                                                                                         |
| --------------------------------------------------------------------------------------------------- | ------ | ------------------------ | ------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `LogicUserCode`                                                                                     | text   | Yes (or `AddlItemCode`)  | empty              | The item code shown as Item Code in Logic ERP (`UserCode` in [Get Item Master](https://kb.logicerp.com/logic-erp-learning-hub-tutorials-and-best-practices/api-documentation/masters/pull/get-item-master.md)). |
| `AddlItemCode`                                                                                      | text   | Yes (or `LogicUserCode`) | empty              | The item's barcode / EAN, used when `LogicUserCode` is empty or not found. When `LogicUserCode` is empty, the item's extra barcodes are also accepted.                                                          |
| `Quantity`                                                                                          | number | Yes                      | –                  | Quantity returned, above `0`. Send a positive number.                                                                                                                                                           |
| `Lot_No`                                                                                            | text   | No                       | empty              | The lot (batch) number. Used to choose the lot only when your API site makes the lot number compulsory for returns; otherwise only checked – see **Stock** and the known issue.                                 |
| `Rate`                                                                                              | number | No                       | Logic ERP's rate   | Rate per unit refunded. `0` = the rate the Sale Return screen would take. The sale history (when switched on) can replace it with the rate of the original sale.                                                |
| `Mrp`                                                                                               | number | No                       | the lot's MRP      | MRP per unit. Only a value above `0` is used.                                                                                                                                                                   |
| `CD_P`, `TD_P`, `SPCD_P`                                                                            | number | No                       | return-level value | CD %, TD % and special CD % for this line. Only values above `0` are used.                                                                                                                                      |
| `Scheme_Rs`, `SchemePerUnit`, `AdjustItem_Rs`, `AdjustmentRs`, `AdjustmentPerUnit`, `LabourPerUnit` | number | No                       | `0`                | Scheme, adjustment and labour amounts for the line, as on Save a Sale Invoice. Only values above `0` are used.                                                                                                  |
| `ItemDescription`                                                                                   | text   | No                       | empty              | A description printed with the line.                                                                                                                                                                            |
| `GodownName`                                                                                        | text   | No                       | `Godown_Name`      | The godown this line goes back into, by name.                                                                                                                                                                   |

`Production_Unit` and `SaleOrSR` are accepted but not used.

**`TenderDetails` – how the money goes back**

| Field           | Type   | Required     | Default    | Meaning                                                                                                                                                                   |
| --------------- | ------ | ------------ | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `TenderType`    | text   | No           | `"CREDIT"` | `"CASH"` (refunded in cash), `"CREDIT"` (left on the party's account), `"CARD"` (refunded to a card) or `"GV"` (gift voucher), in any capitals. Other values are ignored. |
| `Amount`        | number | No           | `0`        | Amount for this tender, in ₹. Not used for `"GV"` – the voucher's own value is used.                                                                                      |
| `CardName`      | text   | For `"CARD"` | empty      | The card type or bank as set up in Logic ERP's card list.                                                                                                                 |
| `CardNo`        | text   | For `"CARD"` | empty      | The card number; 16 characters when your Logic ERP checks card numbers.                                                                                                   |
| `GiftVoucherNo` | text   | For `"GV"`   | empty      | A gift voucher number, checked and applied as on Save a Sale Invoice.                                                                                                     |

### **Rules Logic ERP applies**

* **Branch and financial year.** The return belongs to the branch in `BranchCode` (or `BranchShortName`); `Bill_Date` decides the financial year. A request without either branch field is not refused up front, so always send one of them.
* **What must already exist.** The party, every item, and every name you send (series, godown, agent, transporter, cost centre, tax region, tax form, currency, card name, gift voucher) must exist in Logic ERP. The original sale does **not** have to exist – a return without a matching sale is accepted.
* **What is created.** The sale return, plus – as on a sale – a **retail customer** when the `RCU_…` details match none, and a card number record the first time a card number is used. These two are saved before the return and are kept even if the return then fails.
* **Series and number.** The series is the `BillSeries` you send (a sale return series of the branch), else the return series linked to the party in Logic ERP, else the default return series set for the API site and branch. A `BillSeries` that is not a sale return series of the branch is refused – it is never replaced by another series. The return gets the next number of that series in that year unless you send `Bill_Number`. `Invoice_No` in the response shows the number given.
* **Stock.** The returned quantity is **added back** to stock. No stock check is made – a return is accepted whatever the stock. The item must have at least one lot in Logic ERP, otherwise the request fails with `Stock not available for Item Code : …`.
  * Normally the whole quantity of a line goes back into the item's **oldest lot** (the first one created), unless the sale history supplies the original sale's lot.
  * When your Logic ERP team makes the **lot number compulsory** for returns on the API site, `Lot_No` chooses the lot: Logic ERP looks for that lot of the item on the sale bills carrying the same `OrderNo`, then in this branch and year, then in this branch in any year, then in any branch in this year; failing that, the same search is repeated for the previous financial year. A line whose lot is not found this way is refused. (A `Lot_No` that does not exist for the item at all is refused earlier, with `Unable to found LotNo : … againts EAN/Item Code : …`.) If `Lot_No` is empty, the item's newest lot is used (the newest one sold under that `OrderNo`, when there is one).
  * **Godown.** Each line goes into the godown in `GodownName`, else `Godown_Name`, else the godown the Sale Return screen would use. If the return series has a **default godown for returns**, every line goes into that godown instead, whatever you send. If the series is set to **ask for the return godown**, every line goes into the API site's default return godown, else into `Godown_Name`; with neither, the lines keep the series' or line godown.
* **Tax.** You do not send tax amounts. Logic ERP works out GST and other taxes on each line from the item's tax setup for the return's tax region, as on the Sale Return screen, and the return reduces your tax liability the way a return keyed on screen does. When your setup copies taxes from the sale history, the taxes of the linked sale line are used.
  * `"Tax_Region": "AUTO"` makes Logic ERP choose it from the GST state codes of the branch and the party: same state → `SALE RETURN GST (INCL.)` (or `SALE RETURN UGST(INCL.)` in a union-territory state), different states → `SALE RETURN IGST(INCL.)`. A tax region with that exact name must exist, and both the branch and the party need a GST state code.
  * TCS is **not** added to a return.
* **Refund or credit.** By default the return is a **credit** return: the net amount is credited to the party, and Logic ERP records it as a **pending sale-return credit** for the party, which can later be adjusted against a sale bill (as for a return keyed on screen). No separate credit-note document is created by this endpoint.
  * `"PaymentMode": "CASH"`, or a series set up for cash, makes a cash return.
  * With `TenderDetails`, the amounts are recorded as the return's payment split (cash refunded, amount left on credit, card refund, gift voucher). Two or more tender types, or any card, make it a multi-payment return; a card tender also posts the return to the series' cash account. The API itself does not compare the amounts with the return total – only the Sale Return screen's own save checks apply.
* **Schemes, discounts, round-off** are worked out by Logic ERP as on the Sale Return screen. Your line values (rate, discounts, scheme amounts) are taken in before Logic ERP applies its schemes; the return-level discounts and charges are added after the schemes.
* **Retail customer.** As on Save a Sale Invoice: when `RCU_Mem_Number`, `RCU_Mobile_No` or `RCU_Email` is filled, the customer is looked up (by series and number, or by mobile) and created if not found. For a return only, without mobile and e-mail, the return is linked to the one customer with that `RCU_First_Name`, `RCU_State` and `RCU_PinCode`, if exactly one exists. When your setup copies the retail customer from the sale history and the customer you send differs from the one on the linked sale, the return is refused with `Selected Retail Customer does not match with Sale Return customer.`
* **Duplicates.** Logic ERP does not check whether you sent the same return before; sending it twice saves two returns. If your Logic ERP team switches on "do not allow duplicate order number" for the API site, `OrderNo` becomes required and a second **return** with the same `OrderNo` for the same branch and party in the same financial year is refused (or, in the item-wise variant of that setting, only when it also contains one of the same items). Only returns are compared, so a return may carry the order number of its sale.
* **Party checks.** The party must be a customer, supplier or cash account; any other kind of account is refused. A party locked for billing is refused. All other checks of the Sale Return screen apply; their message comes back in `Message`.
* **All or nothing.** The return and all its lines are saved together. If anything fails, nothing is saved (except a new retail customer or card number, see above).
* **Omni-channel returns.** If your Logic ERP team has linked the return series to other documents for omni-channel returns, those follow-on documents are queued when the return is saved; if they cannot be queued, the return is not saved.
* **Saving later**, **lines with item code `-1`** and the **newer save routine** work as on Save a Sale Invoice.
* Do not use an apostrophe (`'`) in codes, names, order numbers or lot numbers – the request fails.

**How it differs from Save a Sale Invoice**

|                                     | Save a Sale Invoice                                                     | Save a Sale Return                                         |
| ----------------------------------- | ----------------------------------------------------------------------- | ---------------------------------------------------------- |
| Stock                               | Taken out, only from lots with stock (unless negative stock is allowed) | Put back, no stock check                                   |
| Link to an earlier document         | –                                                                       | Sale history by item, party and `OrderNo`                  |
| `Tax_Region`                        | A region name                                                           | A region name or `"AUTO"`                                  |
| TCS                                 | Added when the party is set up for TCS                                  | Not calculated                                             |
| `BillingAddress`, `ShippingAddress` | Saved                                                                   | Ignored                                                    |
| `Token_No`                          | Ignored                                                                 | Saved                                                      |
| Duplicate order number check        | Against sale bills                                                      | Against sale returns                                       |
| Money                               | Payment received                                                        | Refund or credit to the party (pending sale-return credit) |

> **Known issue – `Sale_BillNo` and `Sale_Bill_Date` are not saved.** They are accepted, but they are neither kept on the return nor used to find the original bill. To link a return to its sale, send the sale's order number in `OrderNo` (see **How a return is linked**); keep the original bill number in `Remarks1` if you want it on the return.

> **Known issue – `Lot_No` does not choose the lot unless the lot number is compulsory.** Without that API setting, the lot number is only checked to exist for the item; the goods still go back into the item's oldest lot (or the lot of the linked sale). If the lot number does not exist for the item, the request is refused with `Unable to found LotNo : … againts EAN/Item Code : …` – with or without that setting. Until this is fixed, either ask your Logic ERP team to make the lot number compulsory for returns, or leave `Lot_No` empty.

> **Known issue – a switched-off endpoint answers `"Status": false`.** When your support team has switched this endpoint off for the branch, the answer is `"Status": false` with the message `Request cannot be processed. API Template is marked as In-Active in the configuration.`, not `"Status": true` as described in How Every API Call Works. Either way nothing is saved.

### **Example request**

A credit return of one shirt bought on web order `WEB-10458`, refunded to the party's account:

```json
{
  "BranchCode": 2,
  "PartyUserCode": "C1045",
  "Bill_Date": "2026-10-28",
  "BillSeries": "ESR",
  "Bill_Number": 0,
  "OrderNo": "WEB-10458",
  "OrderDate": "2026-10-20",
  "Tax_Region": "AUTO",
  "Remarks1": "Size exchange - original bill WSL-58",
  "RCU_Mem_Prefix": "RCU",
  "RCU_Mem_Number": 0,
  "RCU_Mobile_No": "9814012345",
  "RCU_First_Name": "Rakesh",
  "LstItems": [
    {
      "LogicUserCode": "SH1042-M",
      "AddlItemCode": "",
      "Quantity": 1,
      "Lot_No": "",
      "Rate": 1299.00,
      "Mrp": 0,
      "ItemDescription": "Wrong size"
    }
  ],
  "TenderDetails": [
    { "TenderType": "CREDIT", "CardName": "", "CardNo": "", "GiftVoucherNo": "", "Amount": 1299.00 }
  ]
}
```

### **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 returns one pair of the test item `APITEST0001`; each send creates one more test return.

## Save a Sale Return

> Records goods a customer has brought back: Logic ERP saves a sale return for the party, puts the items back into stock, reverses the tax and leaves the return amount as a credit for the party that can later be set off against a sale bill. Use it when your shop, website or POS accepts a return. The request has the same shape as Save a Sale Invoice; this page lists every field the return reads and explains where a return behaves differently.

```json
{"openapi":"3.0.3","info":{"title":"Logic ERP API","version":"1.0"},"tags":[{"name":"Sale - Push"}],"servers":[{"url":"https://demo.logicerp.com/api","description":"Logic ERP sandbox (test company)"}],"security":[{"basicAuth":[]}],"components":{"securitySchemes":{"basicAuth":{"type":"http","scheme":"basic","description":"The user name and password of your API site."}}},"paths":{"/SaveSaleReturnInvoice":{"post":{"tags":["Sale - Push"],"operationId":"SaveSaleReturnInvoice","summary":"Save a Sale Return","description":"Records goods a customer has brought back: Logic ERP saves a sale return for the party, puts the items back into stock, reverses the tax and leaves the return amount as a credit for the party that can later be set off against a sale bill. Use it when your shop, website or POS accepts a return. The request has the same shape as Save a Sale Invoice; this page lists every field the return reads and explains where a return behaves differently.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"BranchCode":{"type":"integer","description":"Logic ERP's number of the branch taking the return back (`Branch_Code` in Get Branch Info). The stock comes back into this branch and this branch's API settings are used."},"PartyUserCode":{"type":"string","description":"The account that returns the goods, by its code in Logic ERP (`User_Code` in Get Party Master). It must already exist. Usually the same party as on the original sale."},"Bill_Date":{"type":"string","description":"The return date, `yyyy-MM-dd`. It decides the financial year the return is saved in."},"BillSeries":{"type":"string","description":"The name of a sale return series of this branch, for example `\"ESR\"`."},"Bill_Number":{"type":"integer","description":"`0` = next number of the series. Above `0` = used as the return number; needs `BillSeries` and must not be used yet in that series and year."},"OrderNo":{"type":"string","description":"Your order or reference number. Send the original sale's order number to link the return to that sale (see above). *Required when your API site does not allow a duplicate order number – see Duplicates."},"Remarks1":{"type":"string","description":"Remarks, for example the reason for the return."},"Godown_Name":{"type":"string","description":"The godown the goods go back into, by name, for lines without `GodownName`."},"LstItems":{"type":"array","items":{"type":"object","properties":{"LogicUserCode":{"type":"string","description":"The item code shown as Item Code in Logic ERP (`UserCode` in Get Item Master)."},"Quantity":{"type":"integer","description":"Quantity returned, above `0`. Send a positive number."},"Rate":{"type":"integer","description":"Rate per unit refunded. `0` = the rate the Sale Return screen would take. The sale history (when switched on) can replace it with the rate of the original sale."}}},"description":"The items coming back – see below."},"TenderDetails":{"type":"array","items":{"type":"object"},"description":"How the money goes back – see below. Send `[]` (not `null`) when there are none."}}}}}},"responses":{"200":{"description":"Always HTTP 200. Check Status and Message.","content":{"application/json":{"schema":{"type":"object","properties":{"PrintFile":{"type":"string","description":"Always empty."},"Invoice_No":{"type":"string","description":"The return number, or your `Ext_Bill_No` when you sent one. For a series with its own number format this is the formatted number (for example `26-27/2/ESR-36`); otherwise series and number (for example `ESR-8`). `Message` always shows series and number."},"Order_No":{"type":"string","description":"Always empty for a return."},"PartyOrderNo":{"type":"string","description":"The `OrderNo` you sent."},"Status":{"type":"boolean","description":"`true` when the return was saved."},"Message":{"type":"string","description":"Empty when saved, unless your Logic ERP shows the document number after saving – then it reads like `Saved Doc No. - ESR-8` followed by a line break and ` Doc Date - 28/10/2026`. The reason when not saved."},"LastSavedCode":{"type":"integer","description":"Logic ERP's internal number of the return; `0` when not saved."},"request_ID":{"type":"string","description":"The ID of this request – quote it to support."}}}}}},"401":{"description":"No login was sent."}}}}}}
```

### **Response**

| Field           | Type         | Meaning                                                                                                                                                                                                                                                       |
| --------------- | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `Status`        | true / false | `true` when the return was saved.                                                                                                                                                                                                                             |
| `Message`       | text         | Empty when saved, unless your Logic ERP shows the document number after saving – then it reads like `Saved Doc No. - ESR-8` followed by a line break and `Doc Date - 28/10/2026`. The reason when not saved.                                                  |
| `LastSavedCode` | number       | Logic ERP's internal number of the return; `0` when not saved.                                                                                                                                                                                                |
| `request_ID`    | text         | The ID of this request – quote it to support.                                                                                                                                                                                                                 |
| `Invoice_No`    | text         | The return number, or your `Ext_Bill_No` when you sent one. For a series with its own number format this is the formatted number (for example `26-27/2/ESR-36`); otherwise series and number (for example `ESR-8`). `Message` always shows series and number. |
| `PartyOrderNo`  | text         | The `OrderNo` you sent.                                                                                                                                                                                                                                       |
| `Order_No`      | text         | Always empty for a return.                                                                                                                                                                                                                                    |
| `PrintFile`     | text         | Always empty.                                                                                                                                                                                                                                                 |

### **Example response**

```json
{
  "PrintFile": "",
  "Invoice_No": "ESR-8",
  "Order_No": "",
  "PartyOrderNo": "WEB-10458",
  "Status": true,
  "Message": "",
  "LastSavedCode": 40875,
  "request_ID": "5d0a9e3f-1c42-4b7e-8f26-a91c03e4b7d5"
}
```

### **Messages you may see**

Messages from the Sale Return screen's own checks also come back in `Message`. Where the code adds technical detail, the reason may be followed by technical detail – read the first line.

| Message                                                                                                                                                                                                                        | Meaning                                                                                                                                                        | What to do                                                                                                             |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
| `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 `PartyUserCode`.                                                                                                                           | Check the code with Get Party Master.                                                                                  |
| `Party_User_Code : … is not a Customer / Supplier / Cash account..Please Check...`                                                                                                                                             | `PartyUserCode` belongs to another kind of account (for example a bank or expense account).                                                                    | Send the code of a customer, supplier or cash account.                                                                 |
| `Sale Bill Locked against Party(Setup New Accounts)`                                                                                                                                                                           | The party is locked for billing in Logic ERP.                                                                                                                  | Ask your Logic ERP team.                                                                                               |
| `Unable to found A/E Party : …`                                                                                                                                                                                                | `ActEntryPartyUserCode` was not found.                                                                                                                         | Check the code.                                                                                                        |
| `No Item Present..`                                                                                                                                                                                                            | `LstItems` is empty.                                                                                                                                           | Send at least one line.                                                                                                |
| `LogicUserCode Or EAN Code Cannot Blank!!`                                                                                                                                                                                     | A line has neither item code nor barcode (or both hold only spaces).                                                                                           | Fill one of them.                                                                                                      |
| `Invalid LogicUserCode / EANCode : …`                                                                                                                                                                                          | The item code or barcode was not found.                                                                                                                        | Check it with Get Item Master.                                                                                         |
| `Invalid Item Qty : … for Item Code : … EAN Code : …`                                                                                                                                                                          | A quantity is `0` or negative.                                                                                                                                 | Send a positive quantity.                                                                                              |
| `Lot Number : '…' for Item : '…' not found.....`                                                                                                                                                                               | The lot number is compulsory and that lot of the item was not found in the searches described under **Stock**.                                                 | Check the lot number.                                                                                                  |
| `Stock not available for Item Code : … Quantity : … and Billing Qty : 0`                                                                                                                                                       | The item has no lot Logic ERP can return into.                                                                                                                 | Ask your Logic ERP team.                                                                                               |
| `Invalid Godown Name […]. Please Check...` or `Invalid Godown Name : …`                                                                                                                                                        | `Godown_Name` or a line's `GodownName` was not found.                                                                                                          | Send the godown name as in Logic ERP.                                                                                  |
| `Bill Series : … Not found for Branch Code :… in API Parameter..`                                                                                                                                                              | The `BillSeries` sent is not a sale return series of the branch.                                                                                               | Send a return series of the branch.                                                                                    |
| `Default Bill Series Not Set for Branch Code :…`                                                                                                                                                                               | No series sent and no default set.                                                                                                                             | Send `BillSeries`.                                                                                                     |
| `Cannot allow Bill Saving If Bill Number defined without Bill Series....`                                                                                                                                                      | `Bill_Number` without `BillSeries`.                                                                                                                            | Send both, or neither.                                                                                                 |
| `Bill No. […] against Branch Code : … already exists...Please Check..` (with the series and number in the brackets)                                                                                                            | That return number is used.                                                                                                                                    | Send another number, or `0`.                                                                                           |
| `External bill number not defined. please check.(New Voucher Num)`                                                                                                                                                             | The series needs your own document number.                                                                                                                     | Send `Ext_Bill_No`.                                                                                                    |
| `Order No. Cannot be blank....`                                                                                                                                                                                                | Your API site requires `OrderNo`.                                                                                                                              | Send `OrderNo`.                                                                                                        |
| `Order No. already exists for same Customer.Please Check`                                                                                                                                                                      | A return with this `OrderNo` for this party already exists (see **Duplicates**).                                                                               | Do not resend the same return.                                                                                         |
| A message containing `Invalid Order Id`                                                                                                                                                                                        | `OrderNo` contains `'` or `--`, or is longer than 100 characters, and the sale history is searched.                                                            | Send a plain order number of at most 100 characters.                                                                   |
| `GST_State_Code not defined in Branch Master...` / `GST_State_Code not defined in Party Master...`                                                                                                                             | `"Tax_Region": "AUTO"` but the branch or party has no GST state code.                                                                                          | Fill it in Logic ERP, or send a region name.                                                                           |
| `Unable to found Tax Region : …`                                                                                                                                                                                               | The tax region (or the one chosen by `AUTO`) does not exist.                                                                                                   | Use a name from Logic ERP.                                                                                             |
| `Selected Retail Customer does not match with Sale Return customer.`                                                                                                                                                           | The `RCU_…` customer differs from the customer of the linked sale.                                                                                             | Send the customer of the original sale.                                                                                |
| `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...`    | A retail customer detail is missing (the last two appear when your Logic ERP identifies retail customers by mobile number or by e-mail).                       | Send `RCU_Mem_Prefix`, `RCU_Mobile_No` and `RCU_First_Name` (and `RCU_Email` when customers are identified by e-mail). |
| `Card Name [ … ] not found. Please Check...`                                                                                                                                                                                   | `CardName` is not in Logic ERP's card list.                                                                                                                    | Fix `CardName`.                                                                                                        |
| Technical text containing `Credit Card Number Cannot be Blank..` or `Please check Credit Card Number.... Lenght should be 16 Characters`                                                                                       | A card tender has no card number, or not 16 characters where your Logic ERP checks the length. The reason is wrapped in technical text, not on the first line. | Fix `CardNo`.                                                                                                          |
| `Net Value cannot match with External Net Value...`                                                                                                                                                                            | `Ext_NetSale_Value` differs from Logic ERP's net amount.                                                                                                       | Check rates, discounts and tax region.                                                                                 |
| `Date not Within Financial Year`                                                                                                                                                                                               | `Bill_Date` is outside the financial year.                                                                                                                     | Check the date.                                                                                                        |
| `No financial year covers the date ….`                                                                                                                                                                                         | No financial year in Logic ERP covers `Bill_Date`.                                                                                                             | Check the date, or ask your Logic ERP team to create the year.                                                         |
| `Zero Rate exists at Row No.:…. Please Check.`                                                                                                                                                                                 | No rate was sent or found for a line.                                                                                                                          | Send `Rate`.                                                                                                           |
| `Unable to found Cost Center […] .Please Check`, `Invalid Agent […] .Please Check`, `Invalid Tax Form […] .Please Check`, `Transporter Name [ … ] not found. Please Check...`, `Currency Name : … not found...Please Check...` | A name was not found.                                                                                                                                          | Send it exactly as in Logic ERP.                                                                                       |
| `Exchange Rate not Defined for Currency Name :…...Please Check...`                                                                                                                                                             | `CurrencyName` was sent without an `ExchangeRate` above `0`.                                                                                                   | Send the exchange rate.                                                                                                |
| `Way Bill No. :… not found In Branch Code : …` / `Way Bill No. :… is already Finalized..Please Check`                                                                                                                          | The way bill does not exist in the branch, or it is already finalized.                                                                                         | Send an open way bill of the branch, or leave `WayBillNo` empty.                                                       |
| `Request is pending for processing...`                                                                                                                                                                                         | Your API site keeps requests for later processing.                                                                                                             | See **Saving later** on Save a Sale Invoice.                                                                           |
| `Unable to found LotNo : … againts EAN/Item Code : …`                                                                                                                                                                          | `Lot_No` does not exist for the item.                                                                                                                          | Check or leave out `Lot_No`.                                                                                           |
| A technical error naming a save step                                                                                                                                                                                           | Saving failed inside Logic ERP; nothing was saved.                                                                                                             | Retry once; if it repeats, send the `request_ID` to support.                                                           |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://kb.logicerp.com/logic-erp-learning-hub-tutorials-and-best-practices/api-documentation/sale/push/save-a-sale-return.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
