create_voucher
Create Payment, Receipt, Sales, Purchase, or Journal vouchers in TallyPrime using a simple two-leg debit/credit entry or multi-line entries, with optional bill allocation, cost centres, and manual voucher numbering.
Instructions
Create a new voucher (e.g. Payment, Receipt, Sales, Purchase, Journal) in TallyPrime. Either pass debitLedger/creditLedger/amount for a simple 2-leg voucher, or pass 'entries' for a voucher with 3+ lines (e.g. one payment split across several expense ledgers). Normally omit voucherNumber and let Tally auto-number — but if Tally's numbering series doesn't pick up correctly (confirmed live: a company on a 'PNPC/2026/...' series silently restarted from '1' instead of continuing it), pass voucherNumber explicitly to force the value you want; check get_vouchers for the correct next number first.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| date | Yes | Voucher date in DD-MM-YYYY format | |
| mode | No | Tally's voucher entry mode (the 'Change Voucher Mode' choice in the voucher screen). 'Accounting Invoice' posts it as an invoice with plain ledger lines, the way invoice-mode Tax Invoices are entered — partyLedger is then required. 'As Voucher' posts the normal Dr/Cr voucher view and records that mode. Omit to post the normal voucher view without stamping a mode (right for Payment, Receipt, Contra). For Item Invoice (stock lines) use create_sales_invoice and its siblings instead. | |
| amount | No | Amount of the transaction (simple 2-leg mode; omit if using 'entries') | |
| entries | No | For a voucher with more than 2 lines (e.g. one payment covering three expense ledgers): an array of { ledgerName, amount, type: 'debit'|'credit', billName?, billType?, costCentre?, costCategory?, description? }. Debit and credit amounts must sum to the same total (Tally's double-entry rule) or the call fails with a clear error before reaching Tally. When provided, this replaces debitLedger/creditLedger/amount entirely. | |
| buyerTrn | No | The buyer's TRN as it should appear on THIS voucher, when voucherType is a Sales-side accounting document (e.g. a custom 'Tax Invoice' voucher type entered in Accounting Invoice mode — plain ledger entries, no stock items) — Tally's TRADERCONSVATTINNO/BASICBUYERSSALESTAXNO fields, reverse-engineered from a real such voucher. Only correct when the party ledger IS the buyer (Sales-class); for a Purchase-class voucher the buyer is your own company instead, which this generic field does not distinguish — use create_purchase_invoice's separate buyerTrn/supplierTrn for that case. | |
| buyerName | No | Name to print in this voucher's Buyer (Bill to) box, when it should differ from the customer ledger's own name — Tally's per-voucher Party Details mailing name. The ledger itself is not changed. Useful when many sales are posted against one shared ledger (e.g. cash or card sales) but each invoice needs its own readable buyer name. | |
| narration | No | Narration / description for the voucher | |
| reference | No | Free-text reference for this voucher, backed by Tally's voucher-level REFERENCE field (the same field the 'Order no.' UI field on Order-class vouchers uses) — e.g. a supplier's bill/invoice number like 'PI-061538' on a Payment or Journal settling that bill. Independent of voucherNumber and of any per-leg bill reference name (debitBillName/creditBillName/entries[].billName), which is Tally's separate bill-wise settlement mechanism, not this field. | |
| buyerState | No | The buyer's Emirate/state on this voucher's Party Details (voucher-level STATENAME) — same Sales-class caveat as buyerTrn. | |
| debitLedger | No | Ledger name to debit (simple 2-leg mode; omit if using 'entries') | |
| partyLedger | No | The customer or supplier ledger the invoice is raised on — required with mode 'Accounting Invoice', and must be one of this voucher's own ledger lines (it's placed first and marked as the party, as Tally does). | |
| voucherType | Yes | Voucher type, e.g. 'Payment', 'Receipt', 'Sales', 'Purchase', 'Journal' | |
| buyerCountry | No | The buyer's country on this voucher's Party Details (voucher-level COUNTRYOFRESIDENCE) — same Sales-class caveat as buyerTrn. | |
| costCategory | No | Cost category the cost centre belongs to. Defaults to 'Primary Cost Category'. | |
| creditLedger | No | Ledger name to credit (simple 2-leg mode; omit if using 'entries') | |
| debitBillName | No | Bill reference name to allocate the debit leg against, e.g. for a Payment settling a Purchase bill. Omit for vouchers with no bill-wise tracking. | |
| debitBillType | No | 'New Ref' to open a new bill (e.g. a Purchase/Sales invoice), or 'Agst Ref' to settle an existing one by its exact bill reference name (e.g. a Payment/Receipt against a prior invoice). Also accepts 'Advance' or 'On Account'. Defaults to 'New Ref' if debitBillName is set. | |
| referenceDate | No | Date for the reference above, in DD-MM-YYYY format (Tally's REFERENCEDATE field). Independent of the voucher's own date. Only meaningful if reference is also set. | |
| voucherNumber | No | Explicit voucher number, overriding Tally's automatic numbering. Optional — omit to let Tally assign the next number in its series. | |
| creditBillName | No | Same as debitBillName, for the credit leg. | |
| creditBillType | No | Same as debitBillType, for the credit leg. | |
| debitCostCentre | No | Cost centre to allocate the debit leg to (optional). | |
| creditCostCentre | No | Cost centre to allocate the credit leg to (optional). | |
| debitDescription | No | Additional description lines for the debit leg — Tally's built-in 'Provide Additional Descriptions for Ledgers' text shown in italics under that ledger line (one array entry per line, e.g. ['For KK Trading and', 'Manis Trading']). Optional. | |
| creditDescription | No | Same as debitDescription, for the credit leg. | |
| placeOfSupplyCountry | No | UAE VAT Place of Supply Country (Tally's PLACEOFSUPPLYCOUNTRY field), e.g. 'UAE'. | |
| placeOfSupplyEmirate | No | UAE VAT Place of Supply Emirate for this voucher (Tally's EMIRATEPOS field) — for a standard domestic supply this is normally your own company's Emirate (check get_company_info). |