{
    "info": {
        "_postman_id": "b6a1c0de-5a7e-4c1a-9d10-0b5a3c7a1e01",
        "name": "Basmtak Cashier Partner API v1",
        "description": "Read sales and the catalogue, write items, send orders to the till and receive signed webhooks. Money is always integer halalas (1 SAR = 100). Errors are JSON {error, message, details}; the message follows Accept-Language (ar or en). Lists answer {data, meta}.\n\nGenerated from the OpenAPI file at /developers/openapi.yaml. Set {{token}} to an API client token (Back office → Developers). «Subscribe» stores {{webhook_id}} and {{webhook_secret}}.",
        "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
    },
    "auth": {
        "type": "bearer",
        "bearer": [
            {
                "key": "token",
                "value": "{{token}}",
                "type": "string"
            }
        ]
    },
    "event": [
        {
            "listen": "test",
            "script": {
                "type": "text/javascript",
                "exec": [
                    "if (pm.response.code >= 400 && pm.response.headers.get('Content-Type') && pm.response.headers.get('Content-Type').includes('json')) {",
                    "  pm.test('error answers carry {error, message, details}', function () {",
                    "    const j = pm.response.json();",
                    "    pm.expect(j).to.have.property('error');",
                    "    pm.expect(j).to.have.property('message');",
                    "  });",
                    "}"
                ]
            }
        }
    ],
    "variable": [
        {
            "key": "base_url",
            "value": "https://cashier.basmtak.com/api/partner/v1",
            "type": "string"
        },
        {
            "key": "token",
            "value": "",
            "type": "string"
        },
        {
            "key": "lang",
            "value": "ar",
            "type": "string"
        },
        {
            "key": "webhook_id",
            "value": "",
            "type": "string"
        },
        {
            "key": "webhook_secret",
            "value": "",
            "type": "string"
        },
        {
            "key": "receiver_url",
            "value": "https://example.com/basmtak/webhook",
            "type": "string"
        }
    ],
    "item": [
        {
            "name": "meta",
            "description": "Connectivity",
            "item": [
                {
                    "name": "Check the token and see the client's abilities",
                    "request": {
                        "method": "GET",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json"
                            },
                            {
                                "key": "Accept-Language",
                                "value": "{{lang}}"
                            }
                        ],
                        "url": {
                            "raw": "{{base_url}}/ping",
                            "host": [
                                "{{base_url}}"
                            ],
                            "path": [
                                "ping"
                            ]
                        },
                        "description": "Check the token and see the client's abilities\n\nAbility: any"
                    }
                }
            ]
        },
        {
            "name": "catalogue",
            "description": "Branches, categories, items, price lists and customers",
            "item": [
                {
                    "name": "List branches",
                    "request": {
                        "method": "GET",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json"
                            },
                            {
                                "key": "Accept-Language",
                                "value": "{{lang}}"
                            }
                        ],
                        "url": {
                            "raw": "{{base_url}}/branches",
                            "host": [
                                "{{base_url}}"
                            ],
                            "path": [
                                "branches"
                            ],
                            "query": [
                                {
                                    "key": "page",
                                    "value": "",
                                    "description": "integer",
                                    "disabled": true
                                },
                                {
                                    "key": "per_page",
                                    "value": "",
                                    "description": "integer",
                                    "disabled": true
                                }
                            ]
                        },
                        "description": "List branches\n\nAbility: pos:read"
                    }
                },
                {
                    "name": "List categories",
                    "request": {
                        "method": "GET",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json"
                            },
                            {
                                "key": "Accept-Language",
                                "value": "{{lang}}"
                            }
                        ],
                        "url": {
                            "raw": "{{base_url}}/categories",
                            "host": [
                                "{{base_url}}"
                            ],
                            "path": [
                                "categories"
                            ],
                            "query": [
                                {
                                    "key": "page",
                                    "value": "",
                                    "description": "integer",
                                    "disabled": true
                                },
                                {
                                    "key": "per_page",
                                    "value": "",
                                    "description": "integer",
                                    "disabled": true
                                }
                            ]
                        },
                        "description": "List categories\n\nAbility: pos:read"
                    }
                },
                {
                    "name": "List items with their variants",
                    "request": {
                        "method": "GET",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json"
                            },
                            {
                                "key": "Accept-Language",
                                "value": "{{lang}}"
                            }
                        ],
                        "url": {
                            "raw": "{{base_url}}/items",
                            "host": [
                                "{{base_url}}"
                            ],
                            "path": [
                                "items"
                            ],
                            "query": [
                                {
                                    "key": "page",
                                    "value": "",
                                    "description": "integer",
                                    "disabled": true
                                },
                                {
                                    "key": "per_page",
                                    "value": "",
                                    "description": "integer",
                                    "disabled": true
                                },
                                {
                                    "key": "category_id",
                                    "value": "",
                                    "description": "integer",
                                    "disabled": true
                                },
                                {
                                    "key": "updated_since",
                                    "value": "",
                                    "description": "ISO-8601; only items changed since then",
                                    "disabled": true
                                },
                                {
                                    "key": "sku",
                                    "value": "",
                                    "description": "string",
                                    "disabled": true
                                },
                                {
                                    "key": "barcode",
                                    "value": "",
                                    "description": "string",
                                    "disabled": true
                                }
                            ]
                        },
                        "description": "Each variant carries `plu` (V + variant id), the reference to use in orders.\n\nAbility: pos:read"
                    }
                },
                {
                    "name": "Create an item (one payload with its variants)",
                    "request": {
                        "method": "POST",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json"
                            },
                            {
                                "key": "Accept-Language",
                                "value": "{{lang}}"
                            },
                            {
                                "key": "Content-Type",
                                "value": "application/json"
                            }
                        ],
                        "url": {
                            "raw": "{{base_url}}/items",
                            "host": [
                                "{{base_url}}"
                            ],
                            "path": [
                                "items"
                            ]
                        },
                        "description": "Same payload as the back office. Barcodes and SKUs are unique per account. Without variants one default variant is made at default_price_halalas.\n\nAbility: pos:write",
                        "body": {
                            "mode": "raw",
                            "raw": "{\n    \"name_ar\": \"كابتشينو\",\n    \"name_en\": \"Cappuccino\",\n    \"category_id\": 3,\n    \"variants\": [\n        {\n            \"name_ar\": \"صغير\",\n            \"sku\": \"CAP-S\",\n            \"price_halalas\": 1400,\n            \"is_default\": true\n        },\n        {\n            \"name_ar\": \"كبير\",\n            \"sku\": \"CAP-L\",\n            \"price_halalas\": 1800\n        }\n    ]\n}",
                            "options": {
                                "raw": {
                                    "language": "json"
                                }
                            }
                        }
                    }
                },
                {
                    "name": "One item",
                    "request": {
                        "method": "GET",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json"
                            },
                            {
                                "key": "Accept-Language",
                                "value": "{{lang}}"
                            }
                        ],
                        "url": {
                            "raw": "{{base_url}}/items/:id",
                            "host": [
                                "{{base_url}}"
                            ],
                            "path": [
                                "items",
                                ":id"
                            ],
                            "variable": [
                                {
                                    "key": "id",
                                    "value": "",
                                    "description": "integer"
                                }
                            ]
                        },
                        "description": "One item\n\nAbility: pos:read"
                    }
                },
                {
                    "name": "Update an item",
                    "request": {
                        "method": "PUT",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json"
                            },
                            {
                                "key": "Accept-Language",
                                "value": "{{lang}}"
                            },
                            {
                                "key": "Content-Type",
                                "value": "application/json"
                            }
                        ],
                        "url": {
                            "raw": "{{base_url}}/items/:id",
                            "host": [
                                "{{base_url}}"
                            ],
                            "path": [
                                "items",
                                ":id"
                            ],
                            "variable": [
                                {
                                    "key": "id",
                                    "value": "",
                                    "description": "integer"
                                }
                            ]
                        },
                        "description": "Arrays present in the body (variants, modifier_group_ids, combo_slots) replace what is stored; rows without id are created, missing ids are deleted. Arrays absent are untouched.\n\nAbility: pos:write",
                        "body": {
                            "mode": "raw",
                            "raw": "{}",
                            "options": {
                                "raw": {
                                    "language": "json"
                                }
                            }
                        }
                    }
                },
                {
                    "name": "Price lists with their prices",
                    "request": {
                        "method": "GET",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json"
                            },
                            {
                                "key": "Accept-Language",
                                "value": "{{lang}}"
                            }
                        ],
                        "url": {
                            "raw": "{{base_url}}/price-lists",
                            "host": [
                                "{{base_url}}"
                            ],
                            "path": [
                                "price-lists"
                            ],
                            "query": [
                                {
                                    "key": "page",
                                    "value": "",
                                    "description": "integer",
                                    "disabled": true
                                },
                                {
                                    "key": "per_page",
                                    "value": "",
                                    "description": "integer",
                                    "disabled": true
                                }
                            ]
                        },
                        "description": "Price lists with their prices\n\nAbility: pos:read"
                    }
                },
                {
                    "name": "Customers (consented fields only)",
                    "request": {
                        "method": "GET",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json"
                            },
                            {
                                "key": "Accept-Language",
                                "value": "{{lang}}"
                            }
                        ],
                        "url": {
                            "raw": "{{base_url}}/customers",
                            "host": [
                                "{{base_url}}"
                            ],
                            "path": [
                                "customers"
                            ],
                            "query": [
                                {
                                    "key": "page",
                                    "value": "",
                                    "description": "integer",
                                    "disabled": true
                                },
                                {
                                    "key": "per_page",
                                    "value": "",
                                    "description": "integer",
                                    "disabled": true
                                },
                                {
                                    "key": "updated_since",
                                    "value": "",
                                    "description": "string",
                                    "disabled": true
                                },
                                {
                                    "key": "consented_only",
                                    "value": "",
                                    "description": "Only customers whose latest marketing consent in the consent ledger is granted (never erased ones).",
                                    "disabled": true
                                },
                                {
                                    "key": "consent_channel",
                                    "value": "",
                                    "description": "With consented_only, only consents that cover this channel.",
                                    "disabled": true
                                }
                            ]
                        },
                        "description": "Name, phone, email and address are returned only while the customer's marketing consent is granted (PDPL); otherwise they are null. VAT and CR numbers are always returned.\n\nAbility: pos:read"
                    }
                }
            ]
        },
        {
            "name": "sales",
            "description": "Receipts, Z-reports and stock",
            "item": [
                {
                    "name": "Receipts and credit notes, oldest first, with a since_id cursor",
                    "request": {
                        "method": "GET",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json"
                            },
                            {
                                "key": "Accept-Language",
                                "value": "{{lang}}"
                            }
                        ],
                        "url": {
                            "raw": "{{base_url}}/receipts",
                            "host": [
                                "{{base_url}}"
                            ],
                            "path": [
                                "receipts"
                            ],
                            "query": [
                                {
                                    "key": "since_id",
                                    "value": "",
                                    "description": "string",
                                    "disabled": true
                                },
                                {
                                    "key": "branch_id",
                                    "value": "",
                                    "description": "integer",
                                    "disabled": true
                                },
                                {
                                    "key": "kind",
                                    "value": "",
                                    "description": "string",
                                    "disabled": true
                                },
                                {
                                    "key": "per_page",
                                    "value": "",
                                    "description": "integer",
                                    "disabled": true
                                }
                            ]
                        },
                        "description": "Pass the last receipt id you saw as since_id to get what arrived after it; meta.next_since_id is the value for the next call and meta.has_more says whether to call again now. The order is the server's arrival order, so receipts a till sold offline and synced later are never skipped. Receipts that arrived in the last few seconds are held back.\n\nAbility: pos:read"
                    }
                },
                {
                    "name": "One receipt or credit note",
                    "request": {
                        "method": "GET",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json"
                            },
                            {
                                "key": "Accept-Language",
                                "value": "{{lang}}"
                            }
                        ],
                        "url": {
                            "raw": "{{base_url}}/receipts/:id",
                            "host": [
                                "{{base_url}}"
                            ],
                            "path": [
                                "receipts",
                                ":id"
                            ],
                            "variable": [
                                {
                                    "key": "id",
                                    "value": "",
                                    "description": "string"
                                }
                            ]
                        },
                        "description": "One receipt or credit note\n\nAbility: pos:read"
                    }
                },
                {
                    "name": "The Z-report of a closed till session",
                    "request": {
                        "method": "GET",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json"
                            },
                            {
                                "key": "Accept-Language",
                                "value": "{{lang}}"
                            }
                        ],
                        "url": {
                            "raw": "{{base_url}}/sessions/:id/z-report",
                            "host": [
                                "{{base_url}}"
                            ],
                            "path": [
                                "sessions",
                                ":id",
                                "z-report"
                            ],
                            "variable": [
                                {
                                    "key": "id",
                                    "value": "",
                                    "description": "string"
                                }
                            ]
                        },
                        "description": "The Z as stored at close; deposits already invoiced are netted (prepayments_applied).\n\nAbility: pos:read"
                    }
                },
                {
                    "name": "Stock on hand per branch and variant",
                    "request": {
                        "method": "GET",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json"
                            },
                            {
                                "key": "Accept-Language",
                                "value": "{{lang}}"
                            }
                        ],
                        "url": {
                            "raw": "{{base_url}}/stock/levels",
                            "host": [
                                "{{base_url}}"
                            ],
                            "path": [
                                "stock",
                                "levels"
                            ],
                            "query": [
                                {
                                    "key": "page",
                                    "value": "",
                                    "description": "integer",
                                    "disabled": true
                                },
                                {
                                    "key": "per_page",
                                    "value": "",
                                    "description": "integer",
                                    "disabled": true
                                },
                                {
                                    "key": "branch_id",
                                    "value": "",
                                    "description": "integer",
                                    "disabled": true
                                },
                                {
                                    "key": "variant_id",
                                    "value": "",
                                    "description": "integer",
                                    "disabled": true
                                },
                                {
                                    "key": "low_only",
                                    "value": "",
                                    "description": "boolean",
                                    "disabled": true
                                }
                            ]
                        },
                        "description": "Stock on hand per branch and variant\n\nAbility: pos:read"
                    }
                }
            ]
        },
        {
            "name": "orders",
            "description": "Orders sent to the till's incoming-orders panel",
            "item": [
                {
                    "name": "Send an order to the till",
                    "request": {
                        "method": "POST",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json"
                            },
                            {
                                "key": "Accept-Language",
                                "value": "{{lang}}"
                            },
                            {
                                "key": "Content-Type",
                                "value": "application/json"
                            }
                        ],
                        "url": {
                            "raw": "{{base_url}}/orders",
                            "host": [
                                "{{base_url}}"
                            ],
                            "path": [
                                "orders"
                            ]
                        },
                        "description": "The order appears on the branch till's incoming-orders panel; the cashier accepts it and the receipt is issued on the till. Idempotent on external_id per API client: a retry answers 200 with duplicate true. Lines reference a variant by variant_id, or plu / sku / barcode; a line nothing matches stays an open item with your name and price. Prices are VAT-inclusive halalas; a line without a price takes the catalogue price. Status changes come back as order.status_changed webhooks.\n\nAbility: pos:orders",
                        "body": {
                            "mode": "raw",
                            "raw": "{\n    \"external_id\": \"web-1001\",\n    \"branch_id\": 1,\n    \"order_type\": \"pickup\",\n    \"prepaid\": true,\n    \"customer\": {\n        \"name\": \"Noura\",\n        \"phone\": \"+966501234567\"\n    },\n    \"lines\": [\n        {\n            \"variant_id\": 21,\n            \"qty\": 2,\n            \"unit_price_halalas\": 1800\n        }\n    ]\n}",
                            "options": {
                                "raw": {
                                    "language": "json"
                                }
                            }
                        }
                    }
                },
                {
                    "name": "The status of one of your orders",
                    "request": {
                        "method": "GET",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json"
                            },
                            {
                                "key": "Accept-Language",
                                "value": "{{lang}}"
                            }
                        ],
                        "url": {
                            "raw": "{{base_url}}/orders/:id",
                            "host": [
                                "{{base_url}}"
                            ],
                            "path": [
                                "orders",
                                ":id"
                            ],
                            "variable": [
                                {
                                    "key": "id",
                                    "value": "",
                                    "description": "string"
                                }
                            ]
                        },
                        "description": "The status of one of your orders\n\nAbility: pos:orders"
                    }
                },
                {
                    "name": "Cancel one of your orders",
                    "request": {
                        "method": "POST",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json"
                            },
                            {
                                "key": "Accept-Language",
                                "value": "{{lang}}"
                            },
                            {
                                "key": "Content-Type",
                                "value": "application/json"
                            }
                        ],
                        "url": {
                            "raw": "{{base_url}}/orders/:id/cancel",
                            "host": [
                                "{{base_url}}"
                            ],
                            "path": [
                                "orders",
                                ":id",
                                "cancel"
                            ],
                            "variable": [
                                {
                                    "key": "id",
                                    "value": "",
                                    "description": "string"
                                }
                            ]
                        },
                        "description": "Withdraws the order from the till's incoming-orders panel. Cancelling an order that is already cancelled answers the same order again. If the till already issued its receipt, the receipt stands and the cashier is asked to decide on a refund.\n\nAbility: pos:orders",
                        "body": {
                            "mode": "raw",
                            "raw": "{}",
                            "options": {
                                "raw": {
                                    "language": "json"
                                }
                            }
                        }
                    }
                }
            ]
        },
        {
            "name": "webhooks",
            "description": "REST hooks (Zapier and Make)",
            "item": [
                {
                    "name": "Your subscriptions",
                    "request": {
                        "method": "GET",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json"
                            },
                            {
                                "key": "Accept-Language",
                                "value": "{{lang}}"
                            }
                        ],
                        "url": {
                            "raw": "{{base_url}}/webhooks",
                            "host": [
                                "{{base_url}}"
                            ],
                            "path": [
                                "webhooks"
                            ]
                        },
                        "description": "Your subscriptions\n\nAbility: pos:webhooks"
                    }
                },
                {
                    "name": "Subscribe (REST hook)",
                    "request": {
                        "method": "POST",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json"
                            },
                            {
                                "key": "Accept-Language",
                                "value": "{{lang}}"
                            },
                            {
                                "key": "Content-Type",
                                "value": "application/json"
                            }
                        ],
                        "url": {
                            "raw": "{{base_url}}/webhooks",
                            "host": [
                                "{{base_url}}"
                            ],
                            "path": [
                                "webhooks"
                            ]
                        },
                        "description": "The answer carries the subscription id and its signing secret. The secret is shown only here.\n\nAbility: pos:webhooks",
                        "body": {
                            "mode": "raw",
                            "raw": "{\n    \"target_url\": \"https://hooks.zapier.com/hooks/standard/123/abc\",\n    \"event\": \"receipt.issued\"\n}",
                            "options": {
                                "raw": {
                                    "language": "json"
                                }
                            }
                        }
                    },
                    "event": [
                        {
                            "listen": "test",
                            "script": {
                                "type": "text/javascript",
                                "exec": [
                                    "pm.test('subscribed (201)', function () { pm.response.to.have.status(201); });",
                                    "const j = pm.response.json();",
                                    "if (j.id) pm.collectionVariables.set('webhook_id', String(j.id));",
                                    "if (j.secret) pm.collectionVariables.set('webhook_secret', j.secret);   // shown only once"
                                ]
                            }
                        }
                    ]
                },
                {
                    "name": "The events, each with sample data",
                    "request": {
                        "method": "GET",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json"
                            },
                            {
                                "key": "Accept-Language",
                                "value": "{{lang}}"
                            }
                        ],
                        "url": {
                            "raw": "{{base_url}}/webhooks/events",
                            "host": [
                                "{{base_url}}"
                            ],
                            "path": [
                                "webhooks",
                                "events"
                            ]
                        },
                        "description": "The events, each with sample data\n\nAbility: pos:webhooks"
                    }
                },
                {
                    "name": "Recent real objects of one event (REST hook perform list)",
                    "request": {
                        "method": "GET",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json"
                            },
                            {
                                "key": "Accept-Language",
                                "value": "{{lang}}"
                            }
                        ],
                        "url": {
                            "raw": "{{base_url}}/webhooks/events/:event/recent",
                            "host": [
                                "{{base_url}}"
                            ],
                            "path": [
                                "webhooks",
                                "events",
                                ":event",
                                "recent"
                            ],
                            "query": [
                                {
                                    "key": "limit",
                                    "value": "",
                                    "description": "1 to 25, default 3",
                                    "disabled": true
                                }
                            ],
                            "variable": [
                                {
                                    "key": "event",
                                    "value": "receipt.issued",
                                    "description": "string"
                                }
                            ]
                        },
                        "description": "The newest real objects of one event, each wrapped in the envelope a delivery carries {id, event, tenant_id, occurred_at, api_version, data}, newest first. Zapier calls this as the REST Hook trigger's perform list when a user tests a Zap; Make uses it to fetch sample data. id is event:object-id (stable, for de-duplication), not the uuid of a live delivery. For order.status_changed, from is null and to is the current status. Besides pos:webhooks the client needs the ability that receives the event (pos:read, or pos:orders for order.status_changed). meta.sample is the static sample, for an account with no data yet.\n\nAbility: pos:webhooks"
                    }
                },
                {
                    "name": "One subscription",
                    "request": {
                        "method": "GET",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json"
                            },
                            {
                                "key": "Accept-Language",
                                "value": "{{lang}}"
                            }
                        ],
                        "url": {
                            "raw": "{{base_url}}/webhooks/:id",
                            "host": [
                                "{{base_url}}"
                            ],
                            "path": [
                                "webhooks",
                                ":id"
                            ],
                            "variable": [
                                {
                                    "key": "id",
                                    "value": "{{webhook_id}}",
                                    "description": "integer"
                                }
                            ]
                        },
                        "description": "One subscription\n\nAbility: pos:webhooks"
                    }
                },
                {
                    "name": "Unsubscribe (REST hook)",
                    "request": {
                        "method": "DELETE",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json"
                            },
                            {
                                "key": "Accept-Language",
                                "value": "{{lang}}"
                            }
                        ],
                        "url": {
                            "raw": "{{base_url}}/webhooks/:id",
                            "host": [
                                "{{base_url}}"
                            ],
                            "path": [
                                "webhooks",
                                ":id"
                            ],
                            "variable": [
                                {
                                    "key": "id",
                                    "value": "{{webhook_id}}",
                                    "description": "integer"
                                }
                            ]
                        },
                        "description": "Unsubscribe (REST hook)\n\nAbility: pos:webhooks"
                    }
                }
            ]
        },
        {
            "name": "Webhook signature",
            "description": "Sends a sample receipt.issued delivery, signed with {{webhook_secret}} the way Basmtak signs every delivery, to {{receiver_url}} (your endpoint). Your receiver should accept it, and reject it once you change one byte of the body. Events: receipt.issued, credit_note.issued, session.closed, stock.low, order.status_changed, customer.created.",
            "item": [
                {
                    "name": "Simulate a signed delivery to your receiver",
                    "event": [
                        {
                            "listen": "prerequest",
                            "script": {
                                "type": "text/javascript",
                                "exec": [
                                    "// X-Basmtak-Signature = \"sha256=\" + hex HMAC-SHA256(secret, ts + \"\\n\" + \"POST\" + \"\\n\" + path + \"\\n\" + hex SHA-256(raw body))",
                                    "const secret = pm.collectionVariables.get('webhook_secret');",
                                    "if (!secret) throw new Error('Set webhook_secret first (Subscribe stores it)');",
                                    "const ts = Math.floor(Date.now() / 1000).toString();",
                                    "const body = pm.request.body ? pm.request.body.raw : '';",
                                    "const url = pm.collectionVariables.replaceIn(pm.request.url.toString());",
                                    "let path = url.replace(/^[a-z]+:\\/\\/[^\\/]+/i, '').split('?')[0].split('#')[0];",
                                    "if (!path) path = '/';",
                                    "const canonical = ts + '\\n' + 'POST' + '\\n' + path + '\\n' + CryptoJS.SHA256(body).toString(CryptoJS.enc.Hex);",
                                    "const sig = 'sha256=' + CryptoJS.HmacSHA256(canonical, secret).toString(CryptoJS.enc.Hex);",
                                    "pm.request.headers.upsert({ key: 'X-Basmtak-Timestamp', value: ts });",
                                    "pm.request.headers.upsert({ key: 'X-Basmtak-Signature', value: sig });"
                                ]
                            }
                        }
                    ],
                    "request": {
                        "auth": {
                            "type": "noauth"
                        },
                        "method": "POST",
                        "header": [
                            {
                                "key": "Content-Type",
                                "value": "application/json"
                            },
                            {
                                "key": "X-Basmtak-Event",
                                "value": "receipt.issued"
                            },
                            {
                                "key": "X-Basmtak-Event-Id",
                                "value": "7d3f0c52-1a4b-4c8e-9f21-6b0d2e5a9c11"
                            }
                        ],
                        "body": {
                            "mode": "raw",
                            "raw": "{\n    \"id\": \"7d3f0c52-1a4b-4c8e-9f21-6b0d2e5a9c11\",\n    \"event\": \"receipt.issued\",\n    \"tenant_id\": 1,\n    \"occurred_at\": \"2027-04-02T18:21:07+03:00\",\n    \"api_version\": \"v1\",\n    \"data\": {\n        \"id\": \"01J9ZK3Q7R8S9T0V1W2X3Y4Z5A\",\n        \"number\": \"R1-418\",\n        \"kind\": \"simplified\",\n        \"branch_id\": 1,\n        \"register_id\": 3,\n        \"session_id\": \"01J9ZJ0000000000000000000S\",\n        \"issued_at\": \"2027-04-02T18:21:07+03:00\",\n        \"business_date\": \"2027-04-02\",\n        \"currency\": \"SAR\",\n        \"subtotal_halalas\": 3130,\n        \"tax_halalas\": 470,\n        \"total_halalas\": 3600,\n        \"prepaid_applied\": null,\n        \"amount_due_halalas\": 3600,\n        \"lines\": [\n            {\n                \"line_no\": 1,\n                \"variant_id\": 21,\n                \"name\": \"كابتشينو كبير\",\n                \"qty\": \"2\",\n                \"unit_price_halalas\": 1800,\n                \"total_halalas\": 3600\n            }\n        ],\n        \"payments\": [\n            {\n                \"tender\": \"card\",\n                \"amount_halalas\": 3600,\n                \"scheme\": \"mada\",\n                \"last4\": \"4242\"\n            }\n        ]\n    }\n}",
                            "options": {
                                "raw": {
                                    "language": "json"
                                }
                            }
                        },
                        "url": {
                            "raw": "{{receiver_url}}",
                            "host": [
                                "{{receiver_url}}"
                            ]
                        }
                    }
                }
            ]
        }
    ]
}