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

Create Discount Coupons

Creates discount coupons in Logic ERP – a fixed ₹ discount or a percentage discount, with a minimum bill amount, a start date and an expiry date – so that the tills can accept them. Send one or many coupons in one call. Use it when coupons are issued from your own system (a campaign tool, an app, a loyalty programme).

Endpoint

Name
Detail

Address

https://your-server/api/SaveDiscountCoupon

Method

POST

Authorization

Basic Auth

The response and the messages every endpoint can return are explained in How Every API Call Works.

Request fields

The body is a list (a JSON array) of coupons, even for one coupon; a single coupon sent without the [ ] is answered with the "no body" message (Payload Request Can`t be null. Please Check...). Each coupon:

Field
Type
Required
Default
Meaning

Discount_Coupon_PreFix

text

Yes

""

Prefix of the coupon number, for example "DW". Logic ERP numbers the coupons of each prefix itself (see the rules). Sending null gives a technical error.

Discount_Coupon_Number

number

Yes, in practice

0

Not used as the coupon's number – Logic ERP gives its own (see the rules). It is only used to tell the coupons of one request apart: give every coupon with the same prefix a different number, for example 1, 2, 3 … See the known issues below.

CD_Rs

number

No

0

Fixed discount in ₹.

CD_P

number

No

0

Discount as a percentage of the bill.

Max_Amount_For_CD_P

number

No

0

The most a percentage discount may come to, in ₹.

Minimum_Amount

number

No

0

Minimum bill amount, in ₹, for the coupon to apply.

Start_Date

date

No

empty

First day the coupon may be used, yyyy-MM-dd.

Expiry_Date

date

No

empty

Last day the coupon may be used, yyyy-MM-dd. Send it: a coupon without an expiry date is not listed by Get Pending Discount Coupons.

Create_Date

date

No

today

The coupon's creation date, yyyy-MM-dd. Also stored as its last-changed date.

Creation_Branch_Code

number

No

0

Logic ERP's code of the branch that issued the coupon (Branch_Code in Get Branch Info). Not checked.

Discount_Coupon_Barcode

text

No

empty

Barcode printed on the coupon. Not checked for duplicates.

Ignored although they exist: Discount_Coupon_Num (Logic ERP builds the full number itself) and Sale_Fin_Year (Logic ERP uses the financial year it is working in for your API site).

Rules Logic ERP applies

  • Numbering. Each coupon gets the next free number for its prefix: the highest number already used with that prefix, plus one. The full coupon number the shopper quotes is the prefix followed by that number, for example DW1026. Several coupons with the same prefix in one request get consecutive numbers.

  • All or nothing. The coupons are saved together: if one fails while saving, none are kept.

  • The coupons are not linked to a customer, a coupon group, an item group or a branch group, and are single-use.

  • Nothing checks the amounts: a coupon can carry both CD_Rs and CD_P, or neither. A start date after the expiry date is not refused.

  • A date that cannot be read is ignored without a message (for Create_Date, today is used).

  • Prefixes that begin with another prefix (for example DW and DW1) can produce the same full coupon number (DW + 11 and DW1 + 1 are both DW11). The request then fails with a database error and nothing is saved. Use prefixes that do not begin with one another.

  • If your Logic ERP team has set your company to keep discount coupons in a separate central coupon database, the coupons are saved there instead of in the company. Such coupons are not listed by Get Pending Discount Coupons.

Known issue – the number you send is not the coupon's number, and the response does not tell you the number given. Logic ERP always gives the next free number for the prefix, whatever Discount_Coupon_Number you send, and LastSavedCode is 0. To find the coupons you created, call Get Pending Discount Coupons for the day of the coupons' Create_Date (DateFrom and DateTo = that day; today when you did not send one) and match them on Discount_Coupon_Barcode, which is stored as you send it – so send a barcode that is unique in your system.

Known issue – the "already exists" check does not stop duplicates. The check compares the prefix and the number you send (not the number Logic ERP will give), and when coupons are kept in the company it looks in a separate list meant for central-database coupons, not among the company's own coupons, so it normally finds nothing. Sending the same coupons twice therefore normally creates them twice, with new numbers. Do not re-send a request that answered Status: true. When the check does find a coupon, that coupon is left out without a message and the rest are saved; only when every coupon is left out does the call answer Discount Coupons Already Exist in database....

Known issue – coupons with the same prefix and number in one request are dropped. Logic ERP treats a second coupon with the same prefix and Discount_Coupon_Number as a duplicate and leaves it out without a message; a third gives An item with the same key has already been added. and nothing is saved. This also happens when you leave Discount_Coupon_Number out for several coupons of one prefix (they all count as number 0). Give each coupon of a prefix a different number in the request.

Example request

Test it

Send a request to the Logic ERP sandbox (a test company) from this page: open the block below, enter the sandbox user name and password (ask your Logic ERP support team), change the request if you like, and press Test it. This really saves in the sandbox, so use test values like the example. Each send creates one more test coupon with the prefix APT.

Create Discount Coupons

post

Creates discount coupons in Logic ERP – a fixed ₹ discount or a percentage discount, with a minimum bill amount, a start date and an expiry date – so that the tills can accept them. Send one or many coupons in one call. Use it when coupons are issued from your own system (a campaign tool, an app, a loyalty programme).

Authorizations
AuthorizationstringRequired

The user name and password of your API site.

Bodyobject[]
Discount_Coupon_PreFixstringOptional

Prefix of the coupon number, for example "DW". Logic ERP numbers the coupons of each prefix itself (see the rules). Sending null gives a technical error.

Discount_Coupon_NumberintegerOptional

Not used as the coupon's number – Logic ERP gives its own (see the rules). It is only used to tell the coupons of one request apart: give every coupon with the same prefix a different number, for example 1, 2, 3 … See the known issues below.

CD_RsintegerOptional

Fixed discount in ₹.

Minimum_AmountintegerOptional

Minimum bill amount, in ₹, for the coupon to apply.

Start_DatestringOptional

First day the coupon may be used, yyyy-MM-dd.

Expiry_DatestringOptional

Last day the coupon may be used, yyyy-MM-dd. Send it: a coupon without an expiry date is not listed by Get Pending Discount Coupons.

Creation_Branch_CodeintegerOptional

Logic ERP's code of the branch that issued the coupon (Branch_Code in Get Branch Info). Not checked.

Discount_Coupon_BarcodestringOptional

Barcode printed on the coupon. Not checked for duplicates.

Responses
200

Always HTTP 200. Check Status and Message.

application/json
StatusbooleanOptional

See the Status rules on this page.

MessagestringOptional

Why the call failed, or a note. The reason may be followed by technical detail - read the first line.

LastSavedCodeintegerOptional

See this page.

request_IDstringOptional

Logic ERP request number of this call.

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

[
  {
    "Discount_Coupon_PreFix": "APT",
    "Discount_Coupon_Number": 1,
    "CD_Rs": 250,
    "Minimum_Amount": 1999,
    "Start_Date": "2026-11-01",
    "Expiry_Date": "2026-11-30",
    "Creation_Branch_Code": 3,
    "Discount_Coupon_Barcode": "APT-TEST-0001"
  }
]
{
  "Status": true,
  "Message": "text",
  "LastSavedCode": 1,
  "request_ID": "text"
}

Response

  • Status – true when the coupons were saved.

  • Message – empty when saved; otherwise the reason (see below).

  • LastSavedCode – always 0.

  • request_ID – the ID of this request, as described in How Every API Call Works.

Example response

Messages you may see

Message
Meaning
What to do

Data Not Found!!

The list was empty.

Send at least one coupon.

Discount Coupons Already Exist in database...

Every coupon in the request was left out by the "already exists" check. Nothing was saved.

See the second known issue.

An item with the same key has already been added.

The same prefix and number appeared three or more times in the request (or twice when the "already exists" check found it). Nothing was saved.

Give each coupon of a prefix a different Discount_Coupon_Number.

Object reference not set to an instance of an object.

Discount_Coupon_PreFix was sent as null. Nothing was saved.

Send a prefix.

A database error (with Status: false)

Saving failed, for example two prefixes produced the same full coupon number, another request created coupons of the same prefix at the same moment, or a prefix contained '. Nothing was saved.

Correct the request and send it again.