Back to Blog
Corporate Solutions

e-Müstahsil Receipt Integration: Buying from Farmers

How e-Müstahsil receipt integration works in Turkey: who issues the receipt, building it from weighbridge tickets, withholding from a dated rate table, safe sending with the ETTN, delivery to the farmer, cancellations and paying through the producer ledger.

E-MüstahsilE-FaturaEntegrasyonTarımKurumsal Yazılım

e-Müstahsil receipt integration means that a business buying crops from farmers who keep no books (a trader, a cooperative, a flour or oil mill, a wholesale market agent) generates the producer receipt (müstahsil makbuzu) inside its purchasing and weighbridge software and issues it electronically through an integrator or the Turkish Revenue Administration (GİB) portal. The short answer: the buyer issues the receipt, not the seller; the software takes the net quantity from the weighing ticket, the amount from the agreed price and the withholding from a dated rule table, sends the document with a single ETTN and posts the net amount owed to the farmer to a producer ledger. The real work is not sending the document but making sure the same weighing never lands on two receipts and the wrong rate is never applied.

What is an e-Müstahsil receipt and who issues it?

A producer receipt documents a purchase from a farmer who cannot issue invoices. Unlike an invoice, it is issued by the buyer and shows the farmer’s identity, the product, quantity, price and any deductions. The e-Müstahsil receipt is the electronic version: it is issued and stored electronically instead of on paper and belongs to the e-invoice family. Which buyers must switch, and from when, depends on thresholds and dates in the regulations; the general framework is covered in our e-invoice requirement article. This article is not tax or legal advice; confirm rates and thresholds with your accountant.

The receipt comes from the weighbridge, not from typing

When buying from farmers, the quantity comes from the scale. Issuing receipts on a separate screen by typing quantities means the gap between weighings and documents only appears at month end. An e-Müstahsil integration should therefore use the same data as the weighbridge software, with these rules written into code:

  • A receipt is generated only from closed weighing tickets; the net quantity is gross minus tare and cannot be edited by hand.
  • A weighing ticket can belong to only one receipt; selecting it a second time raises an error.
  • Moisture or foreign matter deductions appear as separate lines with their reason.
  • No receipt is issued until the national ID number on the farmer record has been validated.
  • The price comes from the price list valid at the time of purchase; changes need approval and are logged.
In a good e-Müstahsil integration the list of weighings without a receipt is empty every evening. A full list means either an undocumented purchase or a forgotten payment.

Withholding and deductions: never hard-code the rate

The receipt shows income tax withholding, and the rate can vary by product group, place of sale and date. Hard-coding the rate breaks every historical calculation when the rules change. The right approach is to keep rates in a rule table with product group and effective date, and to store the rate used on every receipt next to the document. Amounts are calculated as integer kurus; floating point arithmetic produces rounding differences. The example below builds a receipt draft from weighing tickets:

type Weighing = { ticketId: string; grossKg: number; tareKg: number };
type RateRule = { productGroup: string; validFrom: string; rateBp: number };
type ReceiptDraft = {
  ticketIds: string[];
  netKg: number;
  grossAmountKurus: number;
  withholdingKurus: number;
  payableKurus: number;
  rateBp: number;
};

// Rates live in a dated table, never in code. rateBp is basis points
// (1% = 100), amounts are integer kurus, so no float rounding drifts.
function findRate(rules: RateRule[], group: string, date: string) {
  const match = rules
    .filter(r => r.productGroup === group && r.validFrom <= date)
    .sort((a, b) => b.validFrom.localeCompare(a.validFrom))[0];
  if (!match) throw new Error('No withholding rule for ' + group + ' on ' + date);
  return match.rateBp;
}

function buildReceipt(
  weighings: Weighing[],
  priceKurusPerKg: number,
  group: string,
  date: string,
  rules: RateRule[],
  alreadyReceipted: Set<string>,
): ReceiptDraft {
  if (weighings.length === 0) throw new Error('No weighing ticket');
  for (const w of weighings) {
    if (alreadyReceipted.has(w.ticketId)) {
      throw new Error('Ticket already on a receipt: ' + w.ticketId);
    }
    if (w.tareKg >= w.grossKg) throw new Error('Invalid ticket: ' + w.ticketId);
  }
  const netKg = weighings.reduce((sum, w) => sum + (w.grossKg - w.tareKg), 0);
  const grossAmountKurus = netKg * priceKurusPerKg;
  const rateBp = findRate(rules, group, date);
  const withholdingKurus = Math.round((grossAmountKurus * rateBp) / 10000);
  return {
    ticketIds: weighings.map(w => w.ticketId),
    netKg,
    grossAmountKurus,
    withholdingKurus,
    payableKurus: grossAmountKurus - withholdingKurus,
    rateBp,
  };
}

Sending, the ETTN, delivery to the farmer and cancellation

Sending works the same way as for other e-documents, as described in our e-invoice integration guide. The ETTN is generated and saved once before sending; a retry after a timeout uses the same ETTN, so the same purchase never gets a second receipt. An integrator replying "received" does not mean the document is accepted; the status is updated by polling or notification. Because the farmer is not a registered recipient, the document reaches them by e-mail, SMS link or paper copy, as with an e-Arşiv invoice, and the delivery result is stored. A sent receipt is never deleted: cancellations and corrections are separate records linked to the original, with the rules kept in a dated table.

Payment, the producer ledger and accounting

Once the receipt is accepted, the amount owed to the farmer is not the gross amount but the net amount after deductions, and it is posted as an accounts receivable and payable ledger entry for that producer. If an advance was paid, the payment closes the advance first and the remaining balance goes to the payment list. Withholding is collected in a separate account because it is needed as a single figure at filing time. The official books stay in the accounting software; receipt, payment and withholding lines are transferred there through an accounting software integration that is one way and safe to repeat.

Conclusion

A good e-Müstahsil receipt integration builds the receipt from weighbridge tickets, never puts the same weighing on two documents, calculates withholding from a dated table to the kurus, sends safely with the ETTN, records delivery to the farmer and links the net amount to the producer ledger. Everything else is screens built on top of that foundation. For a solution that fits your purchasing and weighbridge flow, see our corporate solutions page or describe your current systems and request a quote.

Let's Build Your Project

Get a free consultation for your website, mobile app, or corporate software project.

Get a Free QuoteExplore our Corporate Solutions service