PosApp Open APIs
  1. Đồng giá
PosApp Open APIs
  • Tổng quan
  • Thẻ PosApp
    • Mã lỗi (error code)
    • API Idempotency
    • Nạp tiền vào thẻ
      POST
    • Kiểm tra trạng thái giao dịch
      POST
  • Thông tin khác
    • Digital Signature
  • Webhook
    • Tổng quan
    • Order Schema
    • Warehouse import Schema
  • Sản phẩm
    • Tạo mới sản phẩm
      POST
    • Sửa một sản phẩm
      PATCH
    • Tồn kho sản phẩm
      POST
  • Khuyến mãi
    • Đồng giá
      • Tạo khuyến mãi
        POST
      • Sửa khuyến mãi
        POST
    • Xóa khuyến mãi
      POST
  • Đăng ký tài khoản PosApp
    • Danh sách mô hình kinh doanh
      GET
    • Đăng ký tài khoản
      POST
  1. Đồng giá

Sửa khuyến mãi

Testing
Test Env
https://retail-api.posapp.vn/
Test Env
https://retail-api.posapp.vn/
POST
api/public/promotions/update
API này dùng để cập nhật một khuyến mãi

Request

Header Params
X-API-Key
string 
optional
API key xác thực
Body Params application/json
id
number 
required
ID của khuyến mãi
promotion_name
string 
required
Tên khuyến mãi
promotion_code
string 
required
promotion_type
integer 
required
Mặc định là 10
promotion_subtype
integer 
required
Mặc định là 1
promotion_subtype2
integer 
required
Mặc định là 0
promotion_value
integer 
required
Số tiền đồng giá
start_date
string 
required
Ngày bắt đầu khuyến mãi
end_date
string 
required
Ngày kết thúc khuyến mãi
started_at
integer 
required
Ngày bắt đầu khuyến mãi (dạng timestamp)
ended_at
integer 
required
Ngày kết thúc khuyến mãi (dạng timestamp)
is_weekdays
integer 
required
Áp dụng các ngày trong tuần:
0 là áp dụng tất cả
1 kiểm tra theo điều kiện key weeks gửi lên
weekdays
string 
required
Lưu các ngày trong tuần ví dụ:
1: Thứ hai,
2: Thứ ba,
3: Thứ tư,
4: Thứ năm,
5: Thứ sáu,
6: Thứ bảy,
0: Chủ nhật
Gửi lên dạng string: "0,1,2,3"
weeks
number 
required
Lưu trữ thông tin tuần áp dụng khuyến mãi dạng ví dụ:
1: Tuần 1,
2: Tuần 2,
3: Tuần 3,
4: Tuần 4
is_time
integer 
required
Khung giờ áp dụng:
0: Mặc định tất cả khung giờ
1: Gửi thêm key promotion_time_slots để hệ thống kiểm tra điều kiện
promotion_time_slots
array[string]
required
Lưu dạng "["00:00 - 06:00","21:00 - 00:00"]", cờ is_time = 1
target_type
integer 
required
target_detailtype
array[string]
required
Gửi mảng các id tương ứng
promotion_detail
array [object {5}] 
required
Lưu mảng
foods
string 
optional
foods là 1 mảng stringtify gồm object chứa các phần tử
food_id: là product_id của sản phẩm hoặc là category_id của danh mục
food_name: là tên sản phẩm hoặc tên danh mục
amount: là số lượng sản phẩm mặc định là 1
amount2: mặc định là 1
is_category: Nếu là danh mục thì là true, còn không thì là false
is_all: mặc định là false
unit_master_ids: Mảng object chứa các đơn vị tính của sản phầm bao gồm key
id: là unit_id
name: là unit_name
foods2
string 
optional
Mặc định là "[]"
is_category
boolean 
optional
Nếu là nhóm sản phẩm thì giá trị là true ngược lại là false
is_all
boolean 
optional
Mặc định là false
unit_master_ids
string 
optional
Lưu tất cả các đơn vị tính của foods
is_new
integer 
required
Mặc định là 1
promotion_desc
string 
required
Mô tả khuyến mãi
allow_apply_concurrent_flg
integer 
required
Cho phép áp dụng khuyến mãi này đồng thời với khuyến mãi khác:
Lưu ý: Gửi lên 1 là có và 0 là không
apply_all_branchs
integer 
required
Áp dụng tất cả chi nhánh:
1: Áp dụng tất cả chi nhánh con
0: Gửi lên thêm branches_are_applicable
branches_are_applicable
array [object {2}] 
required
apply_all_branchs = 1 thì không cần gửi lên trường này
include_children_branches
integer 
required
Mặc định là 0
include_progeny_branches
integer 
required
Mặc định là 0
Example
{
    "id": 331,
    "promotion_name": "Đồng giá 20k",
    "promotion_code": "",
    "promotion_type": 10,
    "promotion_subtype": 1,
    "promotion_subtype2": 0,
    "promotion_value": 20000,
    "start_date": "2025-03-18",
    "end_date": "2025-03-26",
    "started_at": 1742256000,
    "ended_at": 1742947200,
    "is_weekdays": 0,
    "weekdays": "2,3,4",
    "weeks": 3,
    "is_time": 0,
    "promotion_time_slots": null,
    "target_type": 0,
    "target_detailtype": "",
    "promotion_detail": [
        {
            "foods": "[{\"food_id\":1120500,\"food_name\":\"Nước ép thơm\",\"amount\":1,\"amount2\":1,\"is_category\":false,\"is_all\":false,\"unit_master_ids\":[{\"id\":115671,\"name\":\"ly\"}]},{\"food_id\":1120501,\"food_name\":\"Nước ép dâu\",\"amount\":1,\"amount2\":1,\"is_category\":false,\"is_all\":false,\"unit_master_ids\":[{\"id\":115671,\"name\":\"ly\"}]}]",
            "foods2": "[]",
            "is_category": false,
            "is_all": false,
            "unit_master_ids": "[{\"id\":115671,\"name\":\"ly\"},{\"id\":115671,\"name\":\"ly\"}]"
        }
    ],
    "is_new": 1,
    "promotion_desc": "Khuyến mãi đồng giá 20k",
    "allow_apply_concurrent_flg": 0,
    "apply_all_branchs": 0,
    "branches_are_applicable": [
        {
            "include_children_branches": 0,
            "include_progeny_branches": 0
        }
    ]
}

Request samples

Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
Request Request Example
Shell
JavaScript
Java
Swift
curl --location --request POST 'https://retail-api.posapp.vn/api/public/promotions/update' \
--header 'X-API-Key;' \
--header 'Content-Type: application/json' \
--data-raw '{
    "id": 331,
    "promotion_name": "Đồng giá 20k",
    "promotion_code": "",
    "promotion_type": 10,
    "promotion_subtype": 1,
    "promotion_subtype2": 0,
    "promotion_value": 20000,
    "start_date": "2025-03-18",
    "end_date": "2025-03-26",
    "started_at": 1742256000,
    "ended_at": 1742947200,
    "is_weekdays": 0,
    "weekdays": "2,3,4",
    "weeks": 3,
    "is_time": 0,
    "promotion_time_slots": null,
    "target_type": 0,
    "target_detailtype": "",
    "promotion_detail": [
        {
            "foods": "[{\"food_id\":1120500,\"food_name\":\"Nước ép thơm\",\"amount\":1,\"amount2\":1,\"is_category\":false,\"is_all\":false,\"unit_master_ids\":[{\"id\":115671,\"name\":\"ly\"}]},{\"food_id\":1120501,\"food_name\":\"Nước ép dâu\",\"amount\":1,\"amount2\":1,\"is_category\":false,\"is_all\":false,\"unit_master_ids\":[{\"id\":115671,\"name\":\"ly\"}]}]",
            "foods2": "[]",
            "is_category": false,
            "is_all": false,
            "unit_master_ids": "[{\"id\":115671,\"name\":\"ly\"},{\"id\":115671,\"name\":\"ly\"}]"
        }
    ],
    "is_new": 1,
    "promotion_desc": "Khuyến mãi đồng giá 20k",
    "allow_apply_concurrent_flg": 0,
    "apply_all_branchs": 0,
    "branches_are_applicable": [
        {
            "include_children_branches": 0,
            "include_progeny_branches": 0
        }
    ]
}'

Responses

🟢200Success
application/json
Body
status
number 
required
status
error_code
number 
required
data
object 
required
msg
string 
required
Example
{
    "status": 1,
    "error_code": 0,
    "data": {
        "id": 3102,
        "shop_id": "1570685368",
        "promotion_code": null,
        "promotion_name": "Đồng giá 20k",
        "promotion_desc": null,
        "main_promotion_id": "0",
        "promotion_type": "10",
        "promotion_subtype": "1",
        "promotion_max_price": "0",
        "promotion_subtype2": "0",
        "promotion_value": "20000",
        "promotion_image": null,
        "target_type": "0",
        "target_detailtype": null,
        "start_date": "2025-03-19",
        "end_date": "2025-03-21",
        "is_weekdays": "1",
        "weekdays": "2,3",
        "weeks": 2,
        "promotion_time_slots": "[\"00:00 - 06:00\",\"21:00 - 00:00\"]",
        "is_time": "1",
        "start_time": null,
        "to_time": null,
        "condition_flag": "0",
        "condition_detail": "0",
        "promotion_extra_condition": null,
        "promotion_subtype2_option": 0,
        "lastupdate": "2025-03-18 14:36:12",
        "branch_ids": "[1640557387,1129987154]",
        "external_app_identifies": null,
        "target_channel": "null",
        "promotion_group_id": null,
        "max_use": "0",
        "count_used": 0,
        "max_use_daily": "0",
        "count_used_today": 0,
        "max_use_per_customer": 0,
        "online_flg": 0,
        "auto_apply_flg": "0",
        "allow_apply_concurrent_flg": "0",
        "apply_on_original_price_flg": "1",
        "status": 0,
        "started_at": "1742342400",
        "ended_at": "1742515200",
        "collaborator_type": null,
        "collaborator_percent": null,
        "topping_flg": "0",
        "reach_amount_flg": "0",
        "minimum_quantity": "0",
        "is_new": "1",
        "gift_many_flg": "0",
        "max_number_gift": "1",
        "apply_all_branchs": "0",
        "branches_are_applicable": [
            {
                "shop_id": 1640557387,
                "shop_name": "Chi nhánh 1",
                "start_date": "2025-03-19",
                "end_date": "2025-03-21",
                "is_weekdays": 1,
                "weekdays": "0,1,2,3,4,5,6",
                "is_time": 1,
                "start_time": null,
                "to_time": null,
                "include_children_branches": 1,
                "include_progeny_branches": 1,
                "use_default_time_option": 1,
                "updated_at": "2025-03-18 14:36:12",
                "shop": {
                    "id": 1640557387,
                    "name": "Chi nhánh 1"
                }
            },
            {
                "shop_id": 1129987154,
                "shop_name": "Chi nhánh 2",
                "start_date": "2025-03-19",
                "end_date": "2025-03-21",
                "is_weekdays": 1,
                "weekdays": "0,1,2,3,4,5,6",
                "is_time": 1,
                "start_time": null,
                "to_time": null,
                "include_children_branches": 1,
                "include_progeny_branches": 1,
                "use_default_time_option": 1,
                "updated_at": "2025-03-18 14:36:12",
                "shop": {
                    "id": 1129987154,
                    "name": "Chi nhánh 2"
                }
            }
        ],
        "promotion_detail": [
            {
                "id": 19184,
                "promotion_id": 3102,
                "foods": "[{\"food_id\":1120500,\"food_name\":\"Nước ép thơm\",\"amount\":1,\"amount2\":1,\"is_category\":false,\"is_all\":false,\"unit_master_ids\":[{\"id\":115671,\"name\":\"ly\",\"plus_price\":0}],\"unit_master2_ids\":[]},{\"food_id\":1120501,\"food_name\":\"Nước ép dâu\",\"amount\":1,\"amount2\":1,\"is_category\":false,\"is_all\":false,\"unit_master_ids\":[{\"id\":115671,\"name\":\"ly\",\"plus_price\":0}],\"unit_master2_ids\":[]}]",
                "unit_master_ids": "[{\"id\":115671,\"name\":\"ly\",\"plus_price\":0},{\"id\":115671,\"name\":\"ly\",\"plus_price\":0}]",
                "food_id": 1120500,
                "food_name": "\"Nước ép thơm\"",
                "amount": 2,
                "foods2": "[]",
                "unit_master2_ids": "[]",
                "food2_id": null,
                "food2_name": null,
                "amount2": 0,
                "amount_used": 0,
                "discount_type": 0,
                "discount_value": 0,
                "change_price": 0,
                "is_category": 0,
                "is_category2": 0,
                "is_all": 0,
                "is_all2": 0,
                "combo_local_id": "0",
                "combo_title": null,
                "combo_price": null,
                "parent_combo_local_id": "0",
                "plus_price": 0,
                "detail_max_price": null,
                "detail_type": 0,
                "combo_select_type": null,
                "combo_max_choose": null,
                "additional_condition": 0,
                "topping_flg": 0,
                "reach_amount_flg": 0,
                "minimum_quantity": 0,
                "combo_product_master_id": 0,
                "combo_price_online": null
            }
        ],
        "promotion_codes": [],
        "child_promotions": []
    },
    "msg": "Thành công",
    "angular_build_version": "82933025dee6ad6ea4d8"
}
Modified at 2025-06-03 09:13:16
Previous
Tạo khuyến mãi
Next
Xóa khuyến mãi
Built with