Coupon
A coupon the retailer issues, with what it takes off and when it can be used.
Area: Coupons and promotions · Why it is here: recipe coupon_rules; recipe rule_guard; sample S31; retail core · Fields: 30
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/Coupon?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/Coupon/⟨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/Coupon" -H "Authorization: token ⟨api key⟩:⟨api secret⟩" \
-H "Content-Type: application/json" -d '{"id": …, "coupon_code": …}'
Change one with PUT /api/resource/Coupon/⟨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.
Samples that use it
s31_parent_groups · s32_coupon_rules
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 |
|---|---|---|---|---|---|---|
| Name | id |
Data | yes | |||
| Has Effective Date | has_valid_date |
Check | ||||
| Start Date | start_date |
Date | ||||
| End Date | end_date |
Date | ||||
| Coupon Code | coupon_code |
Data | yes | |||
| Discount Type | discount_type |
Select | one of: Percent, Amount | |||
| Trigger Quantity | trigger_quantity |
Float | ||||
| Minimum Bill Amount | minimum_bill_amount |
Float | yes | |||
| Maximum Redemption Count Per Store | maximum_redemption_count |
Int | ||||
| Promotion Type | promotion_type |
Select | yes | one of: Bonus Buys, Fixed Price | ||
| Active | active |
Check | ||||
| Lowest Value | lowest_value |
Check | yes | |||
| Sequence Number | sequence_number |
Int | yes | yes | ||
| Description | description |
Data | ||||
| Has Effective Time | has_valid_time |
Check | ||||
| Start Time | start_time |
Time | ||||
| End Time | end_time |
Time | ||||
| Discount | discount_percent |
Float | ||||
| Applicable Quantity | applicable_quantity |
Float | ||||
| Can Repeat In Transaction | can_repeat_in_transaction |
Check | yes | |||
| Exclude Discounted Items | exclude_discounted_items |
Check | yes | |||
| Apply On Item Scan | apply_on_item_scan |
Check | yes | |||
| Apply Once Per Customer | is_apply_once |
Check | yes | |||
| Total Redemption Count | total_redemption_count |
Int | yes | yes | ||
| Is Serial Managed | is_serial_managed |
Check | ||||
| Coupon Items | table_get_items |
Table | Coupon Get Side | |||
| Applicable Source | table_applicable_source |
Table | Coupon Applicability Detail | |||
| Duration | table_applicability |
Table | Coupon Applicability | |||
| Customer Special Days | table_customer_special_days |
Table | yes | Coupon Customer Special Days | ||
| Coupon Exclusion List | table_promotion_exclusion_list |
Table | Coupon Exclude Item |
Table: Coupon Applicability
The rows of table_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: Coupon Applicability Detail
The rows of table_applicable_source. Each row also has idx (its place), parent, parentfield and parenttype.
| Field | Field name | Type | Required | Read-only | Hidden | Links to |
|---|---|---|---|---|---|---|
| Source Type | source_type |
Select | yes | one of: Warehouse | ||
| Source | source |
Dynamic Link | yes |
Table: Coupon Customer Special Days
The rows of table_customer_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 Type | special_days_type |
Select | one of: Birthday, Anniversary | |||
| Duration | special_days_duration |
Select | one of: Day, Week, Month, DaysBackwardForward | |||
| Backward Day | backward_day |
Int | ||||
| Forward Day | forward_day |
Int |
Table: Coupon Exclude Item
The rows of table_promotion_exclusion_list. Each row also has idx (its place), parent, parentfield and parenttype.
| Field | Field name | Type | Required | Read-only | Hidden | Links to |
|---|---|---|---|---|---|---|
| Source Type | source_type |
Select | one of: Customer Group | |||
| Source | source |
Dynamic Link | yes |
Table: Coupon Get Side
The rows of table_get_items. Each row also has idx (its place), parent, parentfield and parenttype.
| Field | Field name | Type | Required | Read-only | Hidden | Links to |
|---|---|---|---|---|---|---|
| Product Type | source_type |
Select | one of: Item, Item Group, Brand | |||
| Value | source_key |
Dynamic Link | ||||
| Description | description |
Data | yes | |||
| UOM | uom |
Link | yes | UOM | ||
| Quantity | quantity |
Int | yes | |||
| Discount Type | discount_type |
Select | yes | one of: Amount, Percent | ||
| Discount | discount |
Float | yes | |||
| Mandatory | is_mandatory |
Check | yes | |||
| Show Prompt | auto_add_in_transaction |
Check | yes |