Skip to content

PrestaShop · through the API

PrestaShop fiscalization in Serbia: fiscal receipts through the BokaPOS API

PrestaShop modules attach to order hooks, so fiscalization is one module that calls the BokaPOS API at the chosen status. BokaPOS does not ship a PrestaShop module; a developer builds one around the API, usually in a day.

The same rules apply to PrestaShop stores in Serbia as to any web shop: an approved ESIR, the Tax Administration's V-PFR, electronic delivery of the receipt to the customer.

The example below is the same call for every platform: a token, then one POST /v1/fiscal-documents with the order's idempotency key. The complete documentation with examples in five languages is on the API page.

Where the integration hooks in

The module registers the hook PrestaShop calls after an order status change (and, where payments arrive immediately, the order validation hook). At the chosen status the module builds the request from items, discounts, shipping and payment, calls BokaPOS and stores the response in its own table linked to the order. An order slip triggers a fiscal refund with the mandatory buyer identification.

Integration steps

Effort
Typically one developer day for someone who knows PrestaShop modules, plus refund testing.

  1. Account and sandbox

    Request BokaPOS access: sandbox credentials and a test security element are free.

  2. Module configuration

    Client id and secret, taxpayer and premise, the triggering status, the mapping of tax rules to labels from GET /v1/tax-rates, the mapping of payment modules to the seven official payment types.

  3. Hook on the status

    At the status send POST /v1/fiscal-documents with an idempotency key from the order reference. Show the PFR number and link in the order admin panel.

  4. Receipt to the customer

    Attach the PDF from /representations/ to the PrestaShop e-mail or switch on the BokaPOS E-mail module.

  5. Refunds and production

    An order slip sends a fiscal refund with the reference and buyer identification. After the tests the taxpayer activates the security element and you switch to production.

The same call for every platform

curl -X POST "https://auth.bokapos.rs/realms/boka/protocol/openid-connect/token" \
  -H "Content-Type: application/x-www-form-urlencoded" \
  -d "grant_type=client_credentials" \
  -d "client_id=$BOKAPOS_CLIENT_ID" \
  -d "client_secret=$BOKAPOS_CLIENT_SECRET"

curl -X POST "https://api.bokapos.rs/v1/fiscal-documents" \
  -H "Authorization: Bearer $BOKAPOS_TOKEN" \
  -H "Idempotency-Key: order-4127-sale-1" \
  -H "Content-Type: application/json" \
  -d '{
  "taxpayerId": "3f9c2a8e-6b1d-4e5a-9c47-1d2b8e6f0a11",
  "businessPremiseId": "b7d4e2c1-9a3f-4c8e-8f21-6e5a0c9d3b22",
  "clientReference": "ORDER-4127",
  "invoiceType": "NORMAL",
  "transactionType": "SALE",
  "cashier": {
    "id": "web-shop",
    "displayName": "Web shop"
  },
  "items": [
    {
      "name": "Bluetooth slušalice",
      "unitOfMeasure": "kom",
      "quantity": 1,
      "unitPrice": 8990,
      "gtin": "8606012345678",
      "taxLabels": [
        "F"
      ]
    }
  ],
  "payments": [
    {
      "type": "CARD",
      "amount": 8990
    }
  ],
  "metadata": {
    "orderId": "4127",
    "channel": "web"
  }
}'

API documentation

Frequently asked questions

Does BokaPOS have a ready-made PrestaShop module?

Not today. The API is documented with PHP examples and the sandbox is free, so a developer builds the module in a day.

Which status should trigger fiscalization?

The one that matches the completed supply: paid for card payments, delivered for cash on delivery. For payments received before delivery use an advance receipt.

How are tax rules mapped?

Every PrestaShop tax rule gets a label read from `GET /v1/tax-rates` (in production Ђ 20%, Е 10%, Г 0%, А 0%). Labels are read live, never hard-coded.

What if the V-PFR does not answer?

The module must not resend blindly. BokaPOS returns a clear unknown-outcome status; the module shows it and waits for a check before any new issue.

Ready to fiscalizefrom your own system?

The sandbox is free, and you issue your first receipt the same day.