Skip to content
Reference

Refunds

Full or partial refund of a receipt BokaPOS issued, with the automatic copy when cash is returned.

1 operations

Refund a receipt

post/v1/refund-workflows

Scoperefund:writeRequires Idempotency-Key

A full or partial refund of a Normal Sale BokaPOS issued. Name the original document, the items by original line index and the returned payments; the buyer is mandatory. When cash is returned, BokaPOS immediately issues the refund copy too.

Contract notes (OpenAPI)

Supports full and partial Normal Refunds. Boka-issued originals are resolved only within the exact taxpayer and premise, and cumulative quantities are prevented from exceeding each stored original line. When any returned payment is cash, Boka automatically issues the required Copy Refundation and renders its customer-signature line. This first bounded workflow accepts only a Boka-stored original; external originals remain unsupported because their cumulative returned quantity cannot be independently proven. Normal fiscal traffic remains governed by the same disabled-by-default provider and uncertain-outcome safeguards.

Request bodyapplication/json

createRefundWorkflow: Request body
FieldDescription
taxpayerIdrequiredType: uuid
businessPremiseIdrequiredType: uuid
clientReferencerequiredType: string
originalrequiredType: BokaDocumentReference
sourcerequiredType: const "BOKA"
fiscalDocumentIdrequiredType: uuid
cashierrequiredType: Cashier
idrequiredType: string
displayNameoptionalType: string
buyerrequiredType: Buyer
idoptionalType: stringOfficial prefix and value, for example 10:123456789.
optionalFieldoptionalType: stringOfficial buyer-cost-center prefix and value where applicable, printed as Опционо поље купца. Allowed only on a Normal Sale: any other invoice type or transaction type is rejected with 422, because the official manual testing procedure lists the field appearing on a receipt that is not a Промет Продаја as a reason to reject an ESIR. A Copy of a Normal Sale that carried it is issued without it for the same reason, and closing an advance case applies it only to the final Normal Sale, never to the closing Advance Refund.
itemsrequiredType: array<RefundWorkflowLineItem>

min 1 items

originalLineIndexrequiredType: integerZero-based index of the exact line on the identified original receipt.

>= 0

catalogProductIdoptionalType: uuidOptional; must match the Boka-stored original line when source is BOKA.
namerequiredType: string

min 1max 2048

unitOfMeasureoptionalType: stringRequired on every item except the codebook advance literals (10: Аванс (Ђ) and siblings), which are prescribed verbatim without a unit. The API refuses any other item without one (422, Items.UnitOfMeasure) and composes it into the signed item name as name/unit.

min 1max 50

quantityrequiredType: numberQuantity returned from this original line.

>= 0.001<= 99999999999.999step 0.001

unitPricerequiredType: numberMust match the final gross unit price on the identified original line when source is BOKA.

>= 0step 0.01

unitPriceBeforeDiscountoptionalType: numberOptional Boka-local pre-discount price; when the source line has it, the value must match exactly and remain greater than unitPrice.

>= 0step 0.0001

gtinoptionalType: string

min 8max 14

taxLabelsrequiredType: array<string>

min 1 itemsunique

paymentsrequiredType: array<Payment>

min 1 items

typerequiredType: PaymentType

ValuesOTHERCASHCARDCHECKWIRE_TRANSFERVOUCHERINSTANT_PAYMENT

amountrequiredType: numberAt most two decimals (the V-PFR rejects more with validation code 2804); the field type on the wire is Decimal(28,4).

>= 0step 0.01

Responses

createRefundWorkflow: Responses
200OKIdempotent replay of a completed refund workflowRefundWorkflow
201CreatedCompleted refund workflowRefundWorkflow
404Not FoundResource does not exist within the authenticated tenant scopeErrorCode
409ConflictThe key was already used with different canonical contentIdempotencyConflict
422Unprocessable ContentThe command violates a Boka or fiscal ruleErrorCode
503Service UnavailableThe refund workflow is incomplete; no missing fiscal step is claimed as issuedRefundWorkflow

Examples

cash

POST/v1/refund-workflows
curl -X POST "https://api.bokapos.rs/v1/refund-workflows" \
  -H "Authorization: Bearer $BOKAPOS_TOKEN" \
  -H "Idempotency-Key: order-4127-refund-1" \
  -H "Content-Type: application/json" \
  -d '{
  "taxpayerId": "3f9c2a8e-6b1d-4e5a-9c47-1d2b8e6f0a11",
  "businessPremiseId": "b7d4e2c1-9a3f-4c8e-8f21-6e5a0c9d3b22",
  "clientReference": "ORDER-4127-R1",
  "original": {
    "source": "BOKA",
    "fiscalDocumentId": "9f8e7d6c-5b4a-4321-8765-0fedcba98761"
  },
  "cashier": {
    "id": "web-shop"
  },
  "buyer": {
    "id": "20:001234567"
  },
  "items": [
    {
      "originalLineIndex": 0,
      "name": "Bluetooth slušalice",
      "unitOfMeasure": "kom",
      "quantity": 1,
      "unitPrice": 8990,
      "gtin": "8606012345678",
      "taxLabels": [
        "F"
      ]
    }
  ],
  "payments": [
    {
      "type": "CASH",
      "amount": 8990
    }
  ]
}'
201Created
{
  "id": "5e6f7a8b-9c0d-4e1f-8a2b-3c4d5e6f7a8b",
  "taxpayerId": "3f9c2a8e-6b1d-4e5a-9c47-1d2b8e6f0a11",
  "businessPremiseId": "b7d4e2c1-9a3f-4c8e-8f21-6e5a0c9d3b22",
  "clientReference": "ORDER-4127-R1",
  "status": "COMPLETED",
  "original": {
    "source": "BOKA",
    "fiscalDocumentId": "9f8e7d6c-5b4a-4321-8765-0fedcba98761",
    "pfrNumber": "JWX4K9PL-JWX4K9PL-1042",
    "pfrTime": "2026-09-01T10:15:32.483+02:00",
    "invoiceType": "NORMAL",
    "transactionType": "SALE"
  },
  "refund": {
    "id": "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d",
    "taxpayerId": "3f9c2a8e-6b1d-4e5a-9c47-1d2b8e6f0a11",
    "businessPremiseId": "b7d4e2c1-9a3f-4c8e-8f21-6e5a0c9d3b22",
    "idempotencyKey": "order-4127-refund-1",
    "clientReference": "ORDER-4127-R1",
    "invoiceType": "NORMAL",
    "transactionType": "REFUND",
    "cashierId": "web-shop",
    "buyerId": "20:001234567",
    "buyerDetails": null,
    "status": "FISCALIZED",
    "fiscalized": true,
    "failureCode": null,
    "retryable": false,
    "pfr": {
      "invoiceNumber": "JWX4K9PL-JWX4K9PL-1045",
      "sdcTime": "2026-09-01T10:15:32.483+02:00",
      "requestedBy": "JWX4K9PL",
      "signedBy": "JWX4K9PL",
      "transactionTypeCounter": 900,
      "totalCounter": 1045,
      "invoiceCounterExtension": "ПР",
      "totalAmount": 8990,
      "totalTax": 890.9009,
      "verificationUrl": "https://sandbox.suf.purs.gov.rs/v/?vl=A0pXWDRLOVBMSldYNEs5UEwSBAAAEAQAAKCLPAAAAAAAAAABnAqJa1EAAAA...",
      "journal": "============ ФИСКАЛНИ РАЧУН ============\n...\nПФР број рачуна:      JWX4K9PL-JWX4K9PL-1045\nБројач рачуна:                900/1045ПР\n========================================\n======== КРАЈ ФИСКАЛНОГ РАЧУНА ========="
    },
    "receipt": {
      "textUrl": "/v1/fiscal-documents/a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d/representations/official-text",
      "jsonUrl": "/v1/fiscal-documents/a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d/representations/canonical-json",
      "pdfA4Url": "/v1/fiscal-documents/a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d/representations/pdf-a4",
      "pdf80mmUrl": "/v1/fiscal-documents/a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d/representations/pdf-80mm",
      "pdf58mmUrl": "/v1/fiscal-documents/a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d/representations/pdf-58mm",
      "previewImageUrl": "/v1/fiscal-documents/a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d/representations/preview-png",
      "qrImageUrl": "/v1/fiscal-documents/a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d/representations/qr-svg",
      "verificationUrl": "https://sandbox.suf.purs.gov.rs/v/?vl=A0pXWDRLOVBMSldYNEs5UEwSBAAAEAQAAKCLPAAAAAAAAAABnAqJa1EAAAA...",
      "preferredPaperFormat": "a4"
    },
    "reference": {
      "fiscalDocumentId": "9f8e7d6c-5b4a-4321-8765-0fedcba98761",
      "pfrNumber": "JWX4K9PL-JWX4K9PL-1042",
      "pfrTime": "2026-09-01T10:15:32.483+02:00"
    },
    "createdAt": "2026-09-01T08:15:31.902Z",
    "updatedAt": "2026-09-01T08:15:32.611Z"
  },
  "cashRefundCopy": {
    "id": "6f7a8b9c-0d1e-4f2a-9b3c-4d5e6f7a8b9c",
    "taxpayerId": "3f9c2a8e-6b1d-4e5a-9c47-1d2b8e6f0a11",
    "businessPremiseId": "b7d4e2c1-9a3f-4c8e-8f21-6e5a0c9d3b22",
    "idempotencyKey": "order-4127-refund-1:copy",
    "clientReference": "COPY-ORDER-4127-R1",
    "invoiceType": "COPY",
    "transactionType": "REFUND",
    "cashierId": "web-shop",
    "buyerId": "20:001234567",
    "buyerDetails": null,
    "status": "FISCALIZED",
    "fiscalized": true,
    "failureCode": null,
    "retryable": false,
    "pfr": {
      "invoiceNumber": "JWX4K9PL-JWX4K9PL-1046",
      "sdcTime": "2026-09-01T10:15:32.483+02:00",
      "requestedBy": "JWX4K9PL",
      "signedBy": "JWX4K9PL",
      "transactionTypeCounter": 901,
      "totalCounter": 1046,
      "invoiceCounterExtension": "КР",
      "totalAmount": 8990,
      "totalTax": 890.9009,
      "verificationUrl": "https://sandbox.suf.purs.gov.rs/v/?vl=A0pXWDRLOVBMSldYNEs5UEwSBAAAEAQAAKCLPAAAAAAAAAABnAqJa1EAAAA...",
      "journal": "============ ФИСКАЛНИ РАЧУН ============\n...\nПФР број рачуна:      JWX4K9PL-JWX4K9PL-1046\nБројач рачуна:                901/1046КР\n========================================\n======== КРАЈ ФИСКАЛНОГ РАЧУНА ========="
    },
    "receipt": {
      "textUrl": "/v1/fiscal-documents/6f7a8b9c-0d1e-4f2a-9b3c-4d5e6f7a8b9c/representations/official-text",
      "jsonUrl": "/v1/fiscal-documents/6f7a8b9c-0d1e-4f2a-9b3c-4d5e6f7a8b9c/representations/canonical-json",
      "pdfA4Url": "/v1/fiscal-documents/6f7a8b9c-0d1e-4f2a-9b3c-4d5e6f7a8b9c/representations/pdf-a4",
      "pdf80mmUrl": "/v1/fiscal-documents/6f7a8b9c-0d1e-4f2a-9b3c-4d5e6f7a8b9c/representations/pdf-80mm",
      "pdf58mmUrl": "/v1/fiscal-documents/6f7a8b9c-0d1e-4f2a-9b3c-4d5e6f7a8b9c/representations/pdf-58mm",
      "previewImageUrl": "/v1/fiscal-documents/6f7a8b9c-0d1e-4f2a-9b3c-4d5e6f7a8b9c/representations/preview-png",
      "qrImageUrl": "/v1/fiscal-documents/6f7a8b9c-0d1e-4f2a-9b3c-4d5e6f7a8b9c/representations/qr-svg",
      "verificationUrl": "https://sandbox.suf.purs.gov.rs/v/?vl=A0pXWDRLOVBMSldYNEs5UEwSBAAAEAQAAKCLPAAAAAAAAAABnAqJa1EAAAA...",
      "preferredPaperFormat": "a4"
    },
    "reference": {
      "fiscalDocumentId": "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d",
      "pfrNumber": "JWX4K9PL-JWX4K9PL-1045",
      "pfrTime": "2026-09-01T16:40:05.120+02:00"
    },
    "createdAt": "2026-09-01T08:15:31.902Z",
    "updatedAt": "2026-09-01T08:15:32.611Z"
  },
  "failureCode": null,
  "createdAt": "2026-09-01T14:40:04.300Z",
  "updatedAt": "2026-09-01T14:40:06.902Z"
}

When cash is returned BokaPOS immediately issues the refund copy too (cashRefundCopy) with the customer-signature line; print it and have the customer sign.

Response: RefundWorkflow

Field descriptions come from the OpenAPI contract; field names and values are identical in both languages.

createRefundWorkflow: Response
FieldDescription
idrequiredType: uuid
taxpayerIdrequiredType: uuid
businessPremiseIdrequiredType: uuid
clientReferencerequiredType: string
statusrequiredType: string

ValuesREFUND_PENDINGREFUND_OUTCOME_UNKNOWNCOPY_PENDINGCOPY_OUTCOME_UNKNOWNCOMPLETEDFAILED

originalrequiredType: RefundWorkflowOriginal
sourcerequiredType: const "BOKA"
fiscalDocumentIdrequiredType: uuid
pfrNumberrequiredType: string
pfrTimerequiredType: date-time
invoiceTyperequiredType: InvoiceType

ValuesNORMALPROFORMACOPYTRAININGADVANCE

transactionTyperequiredType: TransactionType

ValuesSALEREFUND

refundrequiredType: FiscalDocument
idrequiredType: uuid
taxpayerIdrequiredType: uuid
businessPremiseIdrequiredType: uuid
idempotencyKeyrequiredType: string
clientReferencerequiredType: string
invoiceTyperequiredType: InvoiceType

ValuesNORMALPROFORMACOPYTRAININGADVANCE

transactionTyperequiredType: TransactionType

ValuesSALEREFUND

cashierIdrequiredType: string
buyerIdoptionalType: string | null (nullable)
buyerDetailsoptionalType: FiscalBuyerDetails | null (nullable)The buyer's company-registry facts stored with the document at reservation and printed under the buyer identification. Null when the buyer is not a domestic company (prefixes 10, 12, 14 with a valid PIB) or the register could not answer at issuance.
legalNamerequiredType: string

max 350

taxIdentifierrequiredType: string

pattern ^[0-9]{9}$

registrationNumberoptionalType: string | null (nullable)

pattern ^[0-9]{8}$

addressoptionalType: string | null (nullable)

max 300

cityoptionalType: string | null (nullable)

max 100

sourcerequiredType: string

Valuesnbs-jrr

resolvedAtrequiredType: date-time
statusrequiredType: FiscalDocumentStatus

ValuesRECEIVEDVALIDATEDSUBMITTINGFISCALIZEDREJECTEDNOT_FISCALIZEDOUTCOME_UNKNOWNRECONCILING

fiscalizedrequiredType: boolean
failureCodeoptionalType: string | null (nullable)
pfrRejectionoptionalType: object | null (nullable)Present only on a single-document read of a REJECTED operation. The V-PFR's own validation result, bounded to the property path of the caller's request and the supplier's numeric codes (2310 invalid tax label; 2800 to 2808 required, length, range, value, format and list-size validation). Lists never carry it.
itemsrequiredType: array<object>

max 10 items

propertyrequiredType: string

max 120

codesrequiredType: array<string>

max 5 items

retryablerequiredType: boolean
pfroptionalType: PfrResult | null (nullable)
invoiceNumberrequiredType: string
sdcTimerequiredType: date-time
requestedByrequiredType: string
signedByrequiredType: string
transactionTypeCounteroptionalType: integer | null (nullable)V-PFR transaction-type counter (the left half of the printed counter). Null when the stored receipt does not carry it; the printed counter is always in the journal text.
totalCounteroptionalType: integer | null (nullable)V-PFR total counter (the right half of the printed counter and the last segment of invoiceNumber). Null under the same condition as transactionTypeCounter.
invoiceCounterExtensionoptionalType: string | null (nullable)Official Cyrillic invoice/transaction type pair printed after the counter (ПП, ПР, АП, АР, КП, КР, ОП, ОР, РП, РР). Null under the same condition as transactionTypeCounter.
totalAmountrequiredType: number
totalTaxoptionalType: number | null (nullable)Sum of the V-PFR signed tax amounts of the document (the printed "Укупан износ пореза" before its two-decimal display rounding). Null under the same condition as transactionTypeCounter.
verificationUrlrequiredType: uri
journalrequiredType: string
receiptoptionalType: ReceiptRepresentations | null (nullable)
textUrlrequiredType: uri-reference
jsonUrlrequiredType: uri-reference
pdfA4UrlrequiredType: uri-reference
pdf80mmUrlrequiredType: uri-reference
pdf58mmUrlrequiredType: uri-reference
previewImageUrlrequiredType: uri-reference
qrImageUrlrequiredType: uri-reference
verificationUrlrequiredType: uri
preferredPaperFormatrequiredType: stringImmutable preferred print/PDF format captured when this fiscal operation was reserved.

Values80mm58mma4

referenceoptionalType: ResolvedReference
fiscalDocumentIdoptionalType: uuid
pfrNumberrequiredType: string
pfrTimerequiredType: date-time
createdAtrequiredType: date-time
updatedAtrequiredType: date-time
cashRefundCopyoptionalType: FiscalDocument | null (nullable)
idrequiredType: uuid
taxpayerIdrequiredType: uuid
businessPremiseIdrequiredType: uuid
idempotencyKeyrequiredType: string
clientReferencerequiredType: string
invoiceTyperequiredType: InvoiceType

ValuesNORMALPROFORMACOPYTRAININGADVANCE

transactionTyperequiredType: TransactionType

ValuesSALEREFUND

cashierIdrequiredType: string
buyerIdoptionalType: string | null (nullable)
buyerDetailsoptionalType: FiscalBuyerDetails | null (nullable)The buyer's company-registry facts stored with the document at reservation and printed under the buyer identification. Null when the buyer is not a domestic company (prefixes 10, 12, 14 with a valid PIB) or the register could not answer at issuance.
legalNamerequiredType: string

max 350

taxIdentifierrequiredType: string

pattern ^[0-9]{9}$

registrationNumberoptionalType: string | null (nullable)

pattern ^[0-9]{8}$

addressoptionalType: string | null (nullable)

max 300

cityoptionalType: string | null (nullable)

max 100

sourcerequiredType: string

Valuesnbs-jrr

resolvedAtrequiredType: date-time
statusrequiredType: FiscalDocumentStatus

ValuesRECEIVEDVALIDATEDSUBMITTINGFISCALIZEDREJECTEDNOT_FISCALIZEDOUTCOME_UNKNOWNRECONCILING

fiscalizedrequiredType: boolean
failureCodeoptionalType: string | null (nullable)
pfrRejectionoptionalType: object | null (nullable)Present only on a single-document read of a REJECTED operation. The V-PFR's own validation result, bounded to the property path of the caller's request and the supplier's numeric codes (2310 invalid tax label; 2800 to 2808 required, length, range, value, format and list-size validation). Lists never carry it.
itemsrequiredType: array<object>

max 10 items

propertyrequiredType: string

max 120

codesrequiredType: array<string>

max 5 items

retryablerequiredType: boolean
pfroptionalType: PfrResult | null (nullable)
invoiceNumberrequiredType: string
sdcTimerequiredType: date-time
requestedByrequiredType: string
signedByrequiredType: string
transactionTypeCounteroptionalType: integer | null (nullable)V-PFR transaction-type counter (the left half of the printed counter). Null when the stored receipt does not carry it; the printed counter is always in the journal text.
totalCounteroptionalType: integer | null (nullable)V-PFR total counter (the right half of the printed counter and the last segment of invoiceNumber). Null under the same condition as transactionTypeCounter.
invoiceCounterExtensionoptionalType: string | null (nullable)Official Cyrillic invoice/transaction type pair printed after the counter (ПП, ПР, АП, АР, КП, КР, ОП, ОР, РП, РР). Null under the same condition as transactionTypeCounter.
totalAmountrequiredType: number
totalTaxoptionalType: number | null (nullable)Sum of the V-PFR signed tax amounts of the document (the printed "Укупан износ пореза" before its two-decimal display rounding). Null under the same condition as transactionTypeCounter.
verificationUrlrequiredType: uri
journalrequiredType: string
receiptoptionalType: ReceiptRepresentations | null (nullable)
textUrlrequiredType: uri-reference
jsonUrlrequiredType: uri-reference
pdfA4UrlrequiredType: uri-reference
pdf80mmUrlrequiredType: uri-reference
pdf58mmUrlrequiredType: uri-reference
previewImageUrlrequiredType: uri-reference
qrImageUrlrequiredType: uri-reference
verificationUrlrequiredType: uri
preferredPaperFormatrequiredType: stringImmutable preferred print/PDF format captured when this fiscal operation was reserved.

Values80mm58mma4

referenceoptionalType: ResolvedReference
fiscalDocumentIdoptionalType: uuid
pfrNumberrequiredType: string
pfrTimerequiredType: date-time
createdAtrequiredType: date-time
updatedAtrequiredType: date-time
failureCodeoptionalType: string | null (nullable)
createdAtrequiredType: date-time
updatedAtrequiredType: date-time