Loyalty Plan
A loyalty scheme: how points are earned and spent, and in which stores.
Area: Loyalty · Why it is here: retail core · Fields: 17
Read and write it
Every call runs as your app's own user, with its key in one header, at the retailer's own address. The user reads and writes only what its role allows: your app's user, and the rights the retailer gives it.
Read a list (only name unless you ask for fields):
curl -s "https://⟨site⟩/api/resource/Loyalty%20Plan?fields=%5B%22*%22%5D&limit_page_length=20" \
-H "Authorization: token ⟨api key⟩:⟨api secret⟩"
Read one, with its tables:
curl -s "https://⟨site⟩/api/resource/Loyalty%20Plan/⟨name⟩" -H "Authorization: token ⟨api key⟩:⟨api secret⟩"
Create one (the required fields first), if your app's role may:
curl -s -X POST "https://⟨site⟩/api/resource/Loyalty%20Plan" -H "Authorization: token ⟨api key⟩:⟨api secret⟩" \
-H "Content-Type: application/json" -d '{"code": …, "start_date": …, "loyalty_program": …, "plan_type": …, "table_plan_details": …, "table_applicable_stores": …}'
Change one with PUT /api/resource/Loyalty%20Plan/⟨name⟩ and the fields you change; a table sent there replaces its rows, so send its existing rows too. All the record calls and their answers: the API reference.
Fields
Read from the product at POS 2.1.0.667 (till app 60147699c): its own fields, the fields iVendNext adds to it, and iVendNext's changes to any of them. Read-only fields are set by iVendNext; a hidden one is not on the form but can be read. Every record also has name (its id, in the address), owner, creation, modified, modified_by and docstatus (0 a draft, 1 submitted, 2 cancelled), all read-only.
| Field | Field name | Type | Required | Read-only | Hidden | Links to |
|---|---|---|---|---|---|---|
| Code | code |
Data | yes | |||
| Description | description |
Data | ||||
| Start Date | start_date |
Date | yes | |||
| End Date | end_date |
Date | ||||
| Transaction Days Before | transaction_days_before |
Int | ||||
| Birth Date | birth_date |
Check | ||||
| Anniversary Date | anniversary_date |
Check | ||||
| Active | active |
Check | ||||
| Loyalty Program | loyalty_program |
Link | yes | Loyalty Setup | ||
| Plan Type | plan_type |
Select | yes | one of: Normal, Special Days, Special Days for Customers | ||
| Start Time | start_time |
Time | ||||
| End Time | end_time |
Time | ||||
| Plan Details | table_plan_details |
Table | yes | Loyalty Plan Details | ||
| Applicable Stores | table_applicable_stores |
Table | yes | Loyalty Plan Applicable Stores | ||
| Duration | table_loyalty_plan_applicability |
Table | yes | Loyalty Plan Applicability | ||
| Loyalty Exception Rule | table_loyalty_exception_rule |
Table | Loyalty Plan Exception Rule | |||
| Special Days | table_loyalty_special_days |
Table | Loyalty Plan Special Days |
Table: Loyalty Plan Applicability
The rows of table_loyalty_plan_applicability. Each row also has idx (its place), parent, parentfield and parenttype.
| Field | Field name | Type | Required | Read-only | Hidden | Links to |
|---|---|---|---|---|---|---|
| Day | day |
Select | yes | one of: Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday | ||
| Enabled | enabled |
Check | ||||
| Start Time | start_time |
Time | ||||
| End Time | end_time |
Time |
Table: Loyalty Plan Applicable Stores
The rows of table_applicable_stores. Each row also has idx (its place), parent, parentfield and parenttype.
| Field | Field name | Type | Required | Read-only | Hidden | Links to |
|---|---|---|---|---|---|---|
| Store | store |
Link | yes | Warehouse |
Table: Loyalty Plan Details
The rows of table_plan_details. Each row also has idx (its place), parent, parentfield and parenttype.
| Field | Field name | Type | Required | Read-only | Hidden | Links to |
|---|---|---|---|---|---|---|
| Applicable | applicable |
Select | one of: Include, Exclude | |||
| Customer Type | customer_type |
Select | one of: Customer, Customer Group | |||
| Customer Value | customer_value |
Dynamic Link | ||||
| Level | level |
Link | Loyalty Level | |||
| Criteria Group | criteria_group |
Select | one of: Item, Item Group, Bill Value, Bill Quantity | |||
| Criteria Value1 | criteria_value1 |
Dynamic Link | ||||
| Criteria Value2 | criteria_value2 |
Int | ||||
| Tender | tender |
Link | Mode of Payment | |||
| Transaction Criteria | transaction_criteria |
Select | yes | one of: Every, Equal, Greater | ||
| Transaction Count | transaction_count |
Int | yes | |||
| Calculation Basis | calculation_basis |
Select | one of: Amount, Quantity | |||
| Calculation On | calculation_on |
Select | one of: Every, Greater Or Equal | |||
| Calculation Value | calculation_value |
Int | ||||
| Award Value | award_value |
Int | ||||
| Condition | condition |
Code |
Table: Loyalty Plan Exception Rule
The rows of table_loyalty_exception_rule. Each row also has idx (its place), parent, parentfield and parenttype.
| Field | Field name | Type | Required | Read-only | Hidden | Links to |
|---|---|---|---|---|---|---|
| Exception | exception |
Select | one of: Exclude items on promotion, Exclude all items with Discount Override, Exclude all items with Discount greater than X Percent, Exclude all items with Price Override, Exclude all items with Price Override greater than X amount | |||
| Value | value |
Int |
Table: Loyalty Plan Special Days
The rows of table_loyalty_special_days. Each row also has idx (its place), parent, parentfield and parenttype.
| Field | Field name | Type | Required | Read-only | Hidden | Links to |
|---|---|---|---|---|---|---|
| Special Days | special_days |
Link | Loyalty Special Days |