Skip to content

Shopify · through the API

Shopify fiscalization in Serbia: fiscal receipts through the BokaPOS API

Shopify does not run server code inside the store, so fiscalization happens from a custom app or a small server function that listens for paid orders and calls the BokaPOS API. BokaPOS does not ship a Shopify app today; your developer or agency builds the integration, typically in a day or two.

The law does not distinguish between platforms: a Shopify store selling to customers in Serbia is subject to fiscalization like any other web shop. An approved ESIR must issue the receipt through the Tax Administration's V-PFR and the customer receives it electronically.

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

A custom Shopify app (or a server function on your own hosting) subscribes to the paid-order webhook. When it fires, the app reads the line items, amounts and payment method, calls BokaPOS and stores the PFR number and verification link with the order (note or metafield). For refunds it listens to the refund webhook and asks the operator for the buyer identification, which is mandatory.

Integration steps

Effort
Typically one to two developer days, including refund testing in the sandbox.

  1. Account and sandbox

    Request BokaPOS access. You receive an organization, a test security element and a sandbox client id and secret, all free.

  2. Tax labels

    Before every issue, read the labels from GET /v1/tax-rates and map Shopify tax rates to them. Hard-code nothing: the sandbox has test labels, production the official ones.

  3. Paid-order webhook

    On the webhook send POST /v1/fiscal-documents with the items, the payment and an idempotency key derived from the order number. The same key twice returns the same receipt, never two.

  4. Receipt to the customer

    Fetch the PDF or image from /representations/ and send it, or switch on the BokaPOS E-mail module to send it for you.

  5. Refunds and production

    On a refund send a fiscal refund referencing the original with buyer identification. Once tests pass, the taxpayer activates the security element and you receive production credentials.

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 Shopify have built-in fiscalization for Serbia?

No. Shopify does not issue Tax Administration fiscal receipts; an approved ESIR is needed. The integration is done from a custom Shopify app or a server function that calls the BokaPOS API.

Does BokaPOS have a ready-made Shopify app?

Not today. There is a documented API with examples, a free sandbox and an AI-ready documentation bundle, so a developer builds the integration in a day or two.

How does the customer get the receipt?

Electronically: a PDF or image in an e-mail, or a link. In an electronic document the QR code is replaced by the Tax Administration verification link.

What about cash-on-delivery orders?

Cash on delivery is cash; the receipt is issued when the supply happens, in practice at delivery. Your app chooses the moment (for example the delivered status) and calls BokaPOS then.

Ready to fiscalizefrom your own system?

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