Flavours API
ProductModifierPreview

Preview Modifier Charge

POST
/api/v2/products/modifiers/preview

Compute a per-modifier before/after price, tax, and total for a paginated list of product modifiers against a priceable (order type or payment method), reflecting saved overrides or a staged overrides payload.

AuthorizationBearer <token>

You can retrieve your token by logging in.

In: header

Header Parameters

X-API-Version*string

API contract version to target. See the Changelog for what changed in each version.

Default"2.0.0"
Value in"2.3.0" | "2.2.0" | "2.1.0" | "2.0.0"

Request Body

application/json

page?|

Page number for pagination. Must be at least 1.

per_page?|

Number of items per page. Must be at least 1.

search?|

Search in the product name.

sort?|

Sort field and direction (e.g., price, -price).

filter?
priceable_id?|

Key of the priceable (order type key or payment method key). This field is required when priceable_type is present.

priceable_type?|

Priceable the charge belongs to (ORDER_TYPE or PAYMENT_METHOD). This field is required when priceable_id is present.

Value in"ORDER_TYPE" | "PAYMENT_METHOD"
value?number

Per-product charge amount. This field is required when values is not present.

value_type?string

Charge amount type (NOMINAL or PERCENT). Required unless "values" is sent. This field is required when values is not present.

Value in"PERCENT" | "NOMINAL"
values?array<|>

Multiple stacked charges applied in order (alternative to a single value/value_type, e.g. a payment method with several charges). Each is summed onto the running price. Must have at least 1 items.

mode*string

ENTIRELY applies the charge to every modifier; SPECIFIC charges only modifiers with an override.

Value in"ENTIRELY" | "SPECIFIC"
overrides?array<|>

Staged per-modifier charges. When present, the server treats them as authoritative instead of the saved overrides. Must have at least 0 items.

Response Body

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://api.flavours.sa/dev/api/v2/products/modifiers/preview" \  -H "X-API-Version: 2.3.0" \  -H "Content-Type: application/json" \  -d '{    "mode": "ENTIRELY"  }'
{
  "meta": {
    "code": 200,
    "status": "success",
    "message": "Modifier charge preview retrieved successfully."
  },
  "data": {
    "current_page": 1,
    "data": [
      {
        "id": 717712163220414,
        "modifierable_id": "04f829c8-39ce-4e16-822a-fbdc69a38ba0",
        "name_en": null,
        "name_ar": null,
        "type": "OPTION",
        "calorie": null,
        "price": 20,
        "tax": 0,
        "total": 20,
        "cost": null,
        "profit": null,
        "is_tax_included": true,
        "deleted_at": null,
        "barcode": null,
        "barcode_img": null,
        "weight_amount": null,
        "weight_unit": null,
        "market_id": "848aa3f5-fc3d-42d3-8cc9-4c6edd0140d0",
        "branch_id": "7c538fd7-9547-4b16-959d-f01052e04c6f",
        "modifierable_type": "PRODUCT_MODIFIER_PRODUCT",
        "stock": 50,
        "product_id": "04f829c8-39ce-4e16-822a-fbdc69a38ba0",
        "sku": null,
        "charge_value": 2,
        "charge_value_type": "PERCENT",
        "is_override": false,
        "preview": {
          "tax": "0",
          "price": "20.4000000000",
          "total": "20.4000000000"
        },
        "product": {
          "id": "04f829c8-39ce-4e16-822a-fbdc69a38ba0",
          "market_id": "848aa3f5-fc3d-42d3-8cc9-4c6edd0140d0",
          "branch_id": "7c538fd7-9547-4b16-959d-f01052e04c6f",
          "name_en": "Voluptas hic",
          "name_ar": "et",
          "description_en": null,
          "description_ar": null,
          "stock": 50,
          "order": 58,
          "images": null,
          "is_active": true,
          "created_at": 1787446696098,
          "updated_at": 1787446696098,
          "deleted_at": null,
          "rating_amount": 0,
          "rating_avg": "0.00",
          "sold_amount": 0,
          "sold_revenue": 0,
          "qoyod_id": null,
          "min_additionals": null,
          "max_additionals": null,
          "is_global": false,
          "product_category_id": null,
          "preparation_time": null
        }
      },
      {
        "id": 717712166765462,
        "modifierable_id": "5fb26e4b-383c-4361-8eae-f5f991a4e8b3",
        "name_en": null,
        "name_ar": null,
        "type": "OPTION",
        "calorie": null,
        "price": 20,
        "tax": 0,
        "total": 20,
        "cost": null,
        "profit": null,
        "is_tax_included": true,
        "deleted_at": null,
        "barcode": null,
        "barcode_img": null,
        "weight_amount": null,
        "weight_unit": null,
        "market_id": "848aa3f5-fc3d-42d3-8cc9-4c6edd0140d0",
        "branch_id": "7c538fd7-9547-4b16-959d-f01052e04c6f",
        "modifierable_type": "PRODUCT_MODIFIER_PRODUCT",
        "stock": 50,
        "product_id": "5fb26e4b-383c-4361-8eae-f5f991a4e8b3",
        "sku": null,
        "charge_value": 2,
        "charge_value_type": "PERCENT",
        "is_override": false,
        "preview": {
          "tax": "0",
          "price": "20.4000000000",
          "total": "20.4000000000"
        },
        "product": {
          "id": "5fb26e4b-383c-4361-8eae-f5f991a4e8b3",
          "market_id": "848aa3f5-fc3d-42d3-8cc9-4c6edd0140d0",
          "branch_id": "7c538fd7-9547-4b16-959d-f01052e04c6f",
          "name_en": "Accusamus necessitatibus",
          "name_ar": "vero",
          "description_en": null,
          "description_ar": null,
          "stock": 50,
          "order": 59,
          "images": null,
          "is_active": true,
          "created_at": 1787446696964,
          "updated_at": 1787446696964,
          "deleted_at": null,
          "rating_amount": 0,
          "rating_avg": "0.00",
          "sold_amount": 0,
          "sold_revenue": 0,
          "qoyod_id": null,
          "min_additionals": null,
          "max_additionals": null,
          "is_global": false,
          "product_category_id": null,
          "preparation_time": null
        }
      },
      {
        "id": 717712169411060,
        "modifierable_id": "a019166d-ef3c-454f-857c-4210b561a8ca",
        "name_en": null,
        "name_ar": null,
        "type": "OPTION",
        "calorie": null,
        "price": 20,
        "tax": 0,
        "total": 20,
        "cost": null,
        "profit": null,
        "is_tax_included": true,
        "deleted_at": null,
        "barcode": null,
        "barcode_img": null,
        "weight_amount": null,
        "weight_unit": null,
        "market_id": "848aa3f5-fc3d-42d3-8cc9-4c6edd0140d0",
        "branch_id": "7c538fd7-9547-4b16-959d-f01052e04c6f",
        "modifierable_type": "PRODUCT_MODIFIER_PRODUCT",
        "stock": 50,
        "product_id": "a019166d-ef3c-454f-857c-4210b561a8ca",
        "sku": null,
        "charge_value": 2,
        "charge_value_type": "PERCENT",
        "is_override": false,
        "preview": {
          "tax": "0",
          "price": "20.4000000000",
          "total": "20.4000000000"
        },
        "product": {
          "id": "a019166d-ef3c-454f-857c-4210b561a8ca",
          "market_id": "848aa3f5-fc3d-42d3-8cc9-4c6edd0140d0",
          "branch_id": "7c538fd7-9547-4b16-959d-f01052e04c6f",
          "name_en": "Ut deleniti",
          "name_ar": "incidunt",
          "description_en": null,
          "description_ar": null,
          "stock": 50,
          "order": 60,
          "images": null,
          "is_active": true,
          "created_at": 1787446697611,
          "updated_at": 1787446697611,
          "deleted_at": null,
          "rating_amount": 0,
          "rating_avg": "0.00",
          "sold_amount": 0,
          "sold_revenue": 0,
          "qoyod_id": null,
          "min_additionals": null,
          "max_additionals": null,
          "is_global": false,
          "product_category_id": null,
          "preparation_time": null
        }
      },
      {
        "id": 717712178196545,
        "modifierable_id": "94db4076-0a3a-46cf-92d3-5df29064fb96",
        "name_en": null,
        "name_ar": null,
        "type": "OPTION",
        "calorie": null,
        "price": 20,
        "tax": 0,
        "total": 20,
        "cost": null,
        "profit": null,
        "is_tax_included": true,
        "deleted_at": null,
        "barcode": null,
        "barcode_img": null,
        "weight_amount": null,
        "weight_unit": null,
        "market_id": "848aa3f5-fc3d-42d3-8cc9-4c6edd0140d0",
        "branch_id": "7c538fd7-9547-4b16-959d-f01052e04c6f",
        "modifierable_type": "PRODUCT_MODIFIER_PRODUCT",
        "stock": 50,
        "product_id": "94db4076-0a3a-46cf-92d3-5df29064fb96",
        "sku": null,
        "charge_value": 2,
        "charge_value_type": "PERCENT",
        "is_override": false,
        "preview": {
          "tax": "0",
          "price": "20.4000000000",
          "total": "20.4000000000"
        },
        "product": {
          "id": "94db4076-0a3a-46cf-92d3-5df29064fb96",
          "market_id": "848aa3f5-fc3d-42d3-8cc9-4c6edd0140d0",
          "branch_id": "7c538fd7-9547-4b16-959d-f01052e04c6f",
          "name_en": "Rem consequuntur",
          "name_ar": "commodi",
          "description_en": null,
          "description_ar": null,
          "stock": 50,
          "order": 61,
          "images": null,
          "is_active": true,
          "created_at": 1787446699755,
          "updated_at": 1787446699755,
          "deleted_at": null,
          "rating_amount": 0,
          "rating_avg": "0.00",
          "sold_amount": 0,
          "sold_revenue": 0,
          "qoyod_id": null,
          "min_additionals": null,
          "max_additionals": null,
          "is_global": false,
          "product_category_id": null,
          "preparation_time": null
        }
      },
      {
        "id": 717712179726497,
        "modifierable_id": "db6dd349-5965-4fd1-9818-acf7ada72174",
        "name_en": null,
        "name_ar": null,
        "type": "OPTION",
        "calorie": null,
        "price": 20,
        "tax": 0,
        "total": 20,
        "cost": null,
        "profit": null,
        "is_tax_included": true,
        "deleted_at": null,
        "barcode": null,
        "barcode_img": null,
        "weight_amount": null,
        "weight_unit": null,
        "market_id": "848aa3f5-fc3d-42d3-8cc9-4c6edd0140d0",
        "branch_id": "7c538fd7-9547-4b16-959d-f01052e04c6f",
        "modifierable_type": "PRODUCT_MODIFIER_PRODUCT",
        "stock": 50,
        "product_id": "db6dd349-5965-4fd1-9818-acf7ada72174",
        "sku": null,
        "charge_value": 2,
        "charge_value_type": "PERCENT",
        "is_override": false,
        "preview": {
          "tax": "0",
          "price": "20.4000000000",
          "total": "20.4000000000"
        },
        "product": {
          "id": "db6dd349-5965-4fd1-9818-acf7ada72174",
          "market_id": "848aa3f5-fc3d-42d3-8cc9-4c6edd0140d0",
          "branch_id": "7c538fd7-9547-4b16-959d-f01052e04c6f",
          "name_en": "Officia ipsa",
          "name_ar": "vero",
          "description_en": null,
          "description_ar": null,
          "stock": 50,
          "order": 62,
          "images": null,
          "is_active": true,
          "created_at": 1787446700129,
          "updated_at": 1787446700129,
          "deleted_at": null,
          "rating_amount": 0,
          "rating_avg": "0.00",
          "sold_amount": 0,
          "sold_revenue": 0,
          "qoyod_id": null,
          "min_additionals": null,
          "max_additionals": null,
          "is_global": false,
          "product_category_id": null,
          "preparation_time": null
        }
      }
    ],
    "first_page_url": "http://localhost:8000/api/v2/products/modifiers/preview?page=1",
    "from": 1,
    "last_page": 1,
    "last_page_url": "http://localhost:8000/api/v2/products/modifiers/preview?page=1",
    "links": [
      {
        "url": null,
        "label": "&laquo; Previous",
        "page": null,
        "active": false
      },
      {
        "url": "http://localhost:8000/api/v2/products/modifiers/preview?page=1",
        "label": "1",
        "page": 1,
        "active": true
      },
      {
        "url": null,
        "label": "Next &raquo;",
        "page": null,
        "active": false
      }
    ],
    "next_page_url": null,
    "path": "http://localhost:8000/api/v2/products/modifiers/preview",
    "per_page": 20,
    "prev_page_url": null,
    "to": 5,
    "total": 5
  }
}
{
  "meta": {
    "code": 401,
    "status": "error",
    "message": "Unauthenticated."
  },
  "data": null
}
{
  "meta": {
    "code": 403,
    "status": "error",
    "message": "Unauthorized."
  },
  "data": null
}
{
  "meta": {
    "code": 404,
    "status": "error",
    "message": "Resource not found."
  },
  "data": null
}
{
  "meta": {
    "code": 500,
    "status": "error",
    "message": "Internal server error."
  },
  "data": null
}