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

Create Retail Customer

Registers a new retail customer (a shopper or loyalty member) in Logic ERP: name, mobile number, membership number, address, family dates and customer groups. Use it when a customer signs up in your app, website or store system, so that Logic ERP's billing can find them by mobile number or membership number. To change a customer who already exists, use Update Retail Customer instead.

Endpoint

Name
Detail

Address

https://your-server/api/SaveRetailCustomer

Method

POST

Authorization

Basic Auth

The response and the common messages are explained in How Every API Call Works. You can read customers back with Get Retail Customers.

Request fields

One customer per request. Field names are not case-sensitive. Most text values are saved with spaces trimmed from both ends; area, city, state and country names are saved in capitals. Logic ERP does not check the format of the mobile number, e-mail address or GST number.

Field
Type
Required
Default
Meaning

MemberShip_Series

text

Yes

–

The membership series, for example "RCU". Up to 8 characters. Any series is accepted; it does not have to exist in Logic ERP already.

Membership_Number

number

No

0

The membership number within the series. 0 (or left out) = Logic ERP gives the next free number in the series. A number above 0 is used as it is; together with the series it makes the membership number, for example RCU1052.

Mobile_No

text

Yes

–

Mobile number, up to 20 characters.

First_Name

text

Yes

–

First name, up to 50 characters.

Middle_Name, Last_Name

text

No

empty

Middle and last name, up to 50 characters each.

Title

text

No

empty

Title, for example "Mrs.". Up to 5 characters.

EMail_ID

text

No

empty

E-mail address, up to 50 characters.

Gender

number

No

0

0 = male, 1 = female, 2 = not stated (as shown by Get Retail Customers).

Marital_Status

number

No

0

0 = married, 1 = unmarried, 2 = not stated.

Age

number

No

0

Age in years. See the rules for how it is used when no birth date is sent.

Birth_Date

date

No

none

Date of birth, yyyy-MM-dd.

Anniversary_Date

date

No

none

Wedding anniversary, yyyy-MM-dd.

Spouse_Name

text

No

empty

Spouse's name, up to 50 characters.

Spouse_Birthdate

date

No

none

Spouse's date of birth, yyyy-MM-dd.

House_No

text

No

see rules

House or shop number, up to 100 characters. Send "" rather than null when you have none (see the known issue).

Location_Name

text

No

empty

Area or locality, for example "MODEL TOWN".

City_Name

text

No

empty

City.

State_Name

text

No

empty

State.

Country_Name

text

No

empty

Country.

Pin_Code

text

No

empty

PIN code, up to 10 characters.

Address_1, Address_2, Address_3

text

No

empty

Address lines, up to 250 characters each. See the known issue below.

Branch_Code

number

No

0

Logic ERP's number of the branch the customer belongs to (0 = none). It is not checked.

Remarks

text

No

empty

Any remarks.

Shoes_Size

text

No

empty

Shoe size, up to 20 characters.

Discount_Card_No

text

No

empty

A discount card number, kept as text on the customer, up to 30 characters. It does not issue or link a discount card.

Gst_Number

text

No

empty

The customer's GSTIN, up to 30 characters. See the rules.

Gst_State_Code

text

No

see rules

GST state code, for example "03".

Group_Name_1 … Group_Name_5

text

No

empty

The customer's retail customer groups at levels 1 to 5, by name, for example "GOLD". Empty or "(NIL)" = no group at that level.

DisplayError

text

No

"0"

"1" = when the request fails, Message holds the full technical detail. Use only while testing.

Ignored field. Branch_Name is accepted but not used.

Known issue – Address_1 is not saved, and the other address lines move up. Address_1 is dropped. Address_2 is saved as the customer's first address line and Address_3 as the second, so Get Retail Customers returns them as Address_1 and Address_2. Until this is fixed, send your first extra line in Address_2 and your second in Address_3.

Known issue – children are not saved. Kid_1_Name, Kid_2_Name, Kid_1_DOB and Kid_2_DOB are accepted but not saved when a customer is created. Add children in Logic ERP.

Rules Logic ERP applies

  • Duplicates. A customer is refused with Customer already exists... when:

    • you send a Membership_Number above 0 and that series and number already belong to a customer, or

    • you send Membership_Number 0 and any customer already has exactly this mobile number.

    The mobile number is compared as you send it, but it is saved with spaces trimmed. Send it without spaces before or after (see the known issue below).

  • New membership number. With Membership_Number 0, the customer gets the highest number already used in that series plus 1. The new number is not returned – LastSavedCode is Logic ERP's internal customer number. To learn the membership number, call Get Retail Customers with the mobile number.

  • City, state, country and area are created when missing. Each is looked up by name (in capitals; a city or area name is cut to 30 characters):

    • a country or state that does not exist is added with that name – so a misspelt state becomes a new state, with no GST state code;

    • a city is matched by name only, whatever state it is in; a new city is added under the state you sent;

    • an area (Location_Name) is matched by name within the city; a new area is added under that city.

  • Customer groups are created when missing. A Group_Name_… that does not exist at that level is added. Groups are added once the request has passed the first checks, and they are kept even if saving the customer then fails.

  • House number. When House_No is empty, Logic ERP stores Mem No : followed by the membership number. When another customer in the same area and city already has the same house number, the membership number in brackets is added to it, for example 217(RCU1052 ).

  • Main address line. Logic ERP builds the customer's main address itself from house number, area and city, followed by state and country when a city is given. It is cut to 150 characters.

  • Dates that are empty or not a valid date are saved as blank, without an error. Write dates as yyyy-MM-dd.

  • Age without a birth date. When Age is above 0 and Birth_Date is left out or null, Logic ERP also records an estimated date of birth (today minus the age).

  • GST. When Gst_Number is filled, the GST state code is taken from its first two characters, whatever you send in Gst_State_Code. With no GST number and no Gst_State_Code, the GST state code of the state is used. A customer with a GST number also gets a linked customer account in Logic ERP, named after the customer and coded with the membership number, so GST invoices can be made out to them. If an account linked to another customer already has that code, or the same name in the same city, the whole request fails.

  • Loyalty points. If your loyalty setup gives points for enrolling, or for giving details such as mobile number, e-mail address, birthday or anniversary, those points are added to the new customer.

  • Central customer database. If your Logic ERP shares retail customers with other companies through a central customer database (set up by your support team), the customer is also saved there and the new membership number comes from there. Depending on that setup, EMail_ID or Mobile_No must then be filled.

  • The customer is saved as a whole: if anything fails while saving, nothing of the customer is kept (except new customer groups, see above). Branches and financial years do not apply.

Known issue – the mobile number is not checked when you send a membership number. With Membership_Number above 0, a customer is created even if another customer already has the same mobile number. Later look-ups by mobile number (Update Retail Customer, the employee discount endpoints) then use one of them, and you cannot choose which. Before creating a customer with your own membership number, check the mobile number with Get Retail Customers.

Known issue – a mobile number with spaces around it is not seen as a duplicate. The duplicate check compares the mobile number exactly as you send it, but the number is saved with the spaces removed. So " 9812345670" does not match a customer who already has 9812345670, and a second customer with the same mobile number is created. Remove spaces from the mobile number before sending it.

Known issue – "House_No": null makes the call fail. If you send House_No as null, the request fails with a message starting Error creating customer : ERROR Position : 9.1. Send "" instead, or leave the field out.

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's mobile number is already used in the sandbox, so sending it unchanged answers that the customer already exists; change Mobile_No (for example to 9000000005) to create a new test customer.

Create Retail Customer

post

Registers a new retail customer (a shopper or loyalty member) in Logic ERP: name, mobile number, membership number, address, family dates and customer groups. Use it when a customer signs up in your app, website or store system, so that Logic ERP's billing can find them by mobile number or membership number. To change a customer who already exists, use Update Retail Customer instead.

Authorizations
AuthorizationstringRequired

The user name and password of your API site.

Body
MemberShip_SeriesstringOptional

The membership series, for example "RCU". Up to 8 characters. Any series is accepted; it does not have to exist in Logic ERP already.

Membership_NumberintegerOptional

The membership number within the series. 0 (or left out) = Logic ERP gives the next free number in the series. A number above 0 is used as it is; together with the series it makes the membership number, for example RCU1052.

TitlestringOptional

Title, for example "Mrs.". Up to 5 characters.

First_NamestringOptional

First name, up to 50 characters.

Middle_NamestringOptional

Middle and last name, up to 50 characters each.

Last_NamestringOptional

Middle and last name, up to 50 characters each.

EMail_IDstringOptional

E-mail address, up to 50 characters.

Mobile_NostringOptional

Mobile number, up to 20 characters.

Birth_DatestringOptional

Date of birth, yyyy-MM-dd.

GenderintegerOptional

0 = male, 1 = female, 2 = not stated (as shown by Get Retail Customers).

Marital_StatusintegerOptional

0 = married, 1 = unmarried, 2 = not stated.

House_NostringOptional

House or shop number, up to 100 characters. Send "" rather than null when you have none (see the known issue).

Pin_CodestringOptional

PIN code, up to 10 characters.

Address_1stringOptional

Address lines, up to 250 characters each. See the known issue below.

Address_2stringOptional

Address lines, up to 250 characters each. See the known issue below.

Address_3stringOptional

Address lines, up to 250 characters each. See the known issue below.

Branch_CodeintegerOptional

Logic ERP's number of the branch the customer belongs to (0 = none). It is not checked.

Gst_NumberstringOptional

The customer's GSTIN, up to 30 characters. See the rules.

Responses
200

Always HTTP 200. Check Status and Message.

application/json
StatusbooleanOptional

true when the customer was created.

MessagestringOptional

Empty when the customer was created; otherwise the reason.

LastSavedCodeintegerOptional

Logic ERP's internal number of the new customer – the same number as RCU_Code in Get Retail Customers. It is not the membership number. 0 when the request failed.

request_IDstringOptional

Filled once saving has started; empty when the request was refused by the first checks (missing mobile number, name or series, or a duplicate).

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

{
  "MemberShip_Series": "APT",
  "Membership_Number": 0,
  "Title": "Mr.",
  "First_Name": "API TEST",
  "Middle_Name": "",
  "Last_Name": "CUSTOMER ONE",
  "EMail_ID": "apitest1@example.com",
  "Mobile_No": "9000000001",
  "Birth_Date": "1990-05-14",
  "Gender": 0,
  "Marital_Status": 1,
  "House_No": "",
  "Pin_Code": "141001",
  "Address_1": "",
  "Address_2": "Test address - do not use",
  "Address_3": "",
  "Branch_Code": 3,
  "Gst_Number": ""
}
{
  "Status": true,
  "Message": "text",
  "LastSavedCode": 1,
  "request_ID": "text"
}

Response

Field
Meaning for this endpoint

Status

true when the customer was created.

Message

Empty when the customer was created; otherwise the reason.

LastSavedCode

Logic ERP's internal number of the new customer – the same number as RCU_Code in Get Retail Customers. It is not the membership number. 0 when the request failed.

request_ID

Filled once saving has started; empty when the request was refused by the first checks (missing mobile number, name or series, or a duplicate).

Example response

Messages you may see

All with Status: false.

Message
Meaning
What to do

Please Define Mobile No. to Continue...

Mobile_No is missing or empty.

Send the mobile number.

Customer First Name not defined...Please Check..

First_Name is missing or blank.

Send the first name.

Please Define Customer Membership Series to Continue...:

MemberShip_Series is missing or empty.

Send the series.

Customer already exists...

The membership number, or (with Membership_Number 0) the mobile number, already belongs to a customer – see the rules.

Use Update Retail Customer to change that customer, or check the number you sent.

Mobile Number cannot be blank... or EMail id cannot be blank...

Your Logic ERP uses a central customer database that identifies customers by mobile number or e-mail address, and that field is empty.

Fill the field named.

Membership number cannot be blank.

MemberShip_Series holds only spaces and Membership_Number is 0.

Send a real series.

Membership Series cannot be blank...

MemberShip_Series holds only spaces and Membership_Number is above 0.

Send a real series.

A message starting Cannot Open Remote Database

Logic ERP could not reach the central customer database.

Try again later; if it continues, ask your Logic ERP support team.

A message starting Error creating customer : ERROR Position : …

Saving failed, for example because a text is longer than the field allows, or House_No was null. The reason may be followed by technical detail – read the first lines.

Check the lengths in the table above and send House_No as text.

A message starting Error creating customer : ERROR Position : … followed by Account creation against retail customer -> User Code Already Exists or Account creation against retail customer -> Account Name Already Exits

The customer has a GST number, and the customer account Logic ERP tries to create clashes with the account of another customer (see GST in the rules).

Ask your Logic ERP team to check the existing account.

A database error

The mobile number, membership series, a group name or the house number contains a '.

Send them without quotes.

Last updated