Choose what you allow. Your choice applies on every tracken.ee address and you can change it any time with “Cookie settings” in the footer.

Remember your cookie choice, language and theme. Without them the site doesn't work the way you chose.

A cookie with your choice (6 months); language and theme in browser storage.


The services below learn that you visited this site, whether you came from their ad and whether you then created a Tracken account. That shows us which ads work, and these companies may show you Tracken ads later. They may link the data to your account with them. For Meta, Tracken ID's server reports the new account and also sends a hash of your e-mail address, your IP address and browser details.

ServiceCookiesKept for up to
Meta (Facebook, Instagram)_fbp, _fbc90 days

Tracken's own visit counter uses no cookies, stores no IP addresses and shares nothing with anyone. Privacy policy

Skip to content
Beta
BetaThe Tracken Accounts API is in beta: it may still change before v1, and every change is announced in the changelog.
API referenceDocuments of recordPayments

Create a payment

live
POST/v1/payments
Scope payments:writeMCP tool create_paymentOperation id createPayment

Record money paid on one issued sales invoice (incoming) or posted purchase invoice (outgoing), by bank transfer or in cash, and post its entry. The document's amount_paid and status follow.

Details

With transaction_id the payment is linked to an imported transaction that already posted it, and nothing is posted (a migration's historical payment). A bank statement line is reconciled on the bank line instead, which records its payments itself.

Parameters

headers and query
Idempotency-Keyheader · stringat most 255 characters

Optional replay guard for a POST (DA-065). Send a key the CLIENT generates (a uuid per user-initiated request, reused across retries of that same request). The server performs the operation at most once per (organization, key) and answers a replay with the ORIGINAL response (status, headers and body), so a double-clicked Save or a retry after an ambiguous timeout never creates or posts anything twice.

Details

A request that FAILED frees its key, so retrying after a genuine error proceeds normally. Reusing a key with a DIFFERENT body is a client bug, not a retry, and returns 409 IDEMPOTENCY_KEY_REUSED rather than the earlier response. Keys are kept for 24 hours; a retry after that is a new request. Omitting the header keeps the previous behaviour exactly.

dry_runquery · booleandefault false

Validate and compute without storing anything: the answer is what the real request would answer (status, errors, computed totals, assigned numbers) but nothing is saved, posted or sent, and the response carries Tracken-Dry-Run: true.

Tracken-On-Behalf-Ofheader · stringat most 200 characters

For an app's installation token: the person the app acts for (its own user id and name, e.g. res_123 Mari Maasikas). Recorded in the audit log beside the app; never used for access, which the app enforces.

Request body

application/json · required
dataPaymentInputrequired

A payment to record, and the document it settles.

Most used attributes of data

datestring (date)required

Payment date; it sets the accounting period of the posting.

directionPaymentDirectionrequired

Money in (a customer pays a sales invoice, a supplier refunds a purchase) or out (a purchase invoice is paid, a customer is refunded). Named, never implied by a sign.

One of incoming, outgoing

amountstringrequireddecimal string

The money that moved, positive, in currency. In the document's currency it is at most what is still due on the document and equals the allocation's amount.

methodPaymentRecordMethodrequired

How it was paid: bank_transfer posts to the bank account's ledger account, cash to the organization's default cash account.

One of bank_transfer, cash

allocationsarray of PaymentAllocationInputrequiredat most 1 items

The one document this payment settles.

3 attributes of each item
document_typestringrequired

Kind of document settled.

One of sales_invoice, purchase_invoice

document_idstring (uuid)required

The document settled.

amountstringrequireddecimal string

Amount applied to the document, positive, in the document's currency. When the payment is in the document's currency it equals the payment's amount; a payment in another currency (a euro bank payment of a dollar invoice) settles this much of the document.

currencystring · nullable

Currency of amount, the money that moved (ISO 4217): that of the bank or cash account. Defaults to the document's currency.

bank_account_idstring (uuid) · nullable

For bank_transfer: the bank account it moved on; defaults to the organization's default bank account. Not sent with cash.

contact_idstring (uuid) · nullable

The document's contact; another is refused.

4 more attributes
referencestring · nullableat most 255 characters

Bank reference or receipt number.

notesstring · nullableat most 2000 characters

Free text.

transaction_idstring (uuid) · nullable

An imported transaction (origin: import, posted by no document) that already books this payment: the payment is linked to it and nothing is posted. Its receivable (sales) or payable (purchase) lines must carry the amount in the payment's direction beyond the payments already linked to it in that direction (400 PAYMENT_TRANSACTION_NOT_LINKABLE otherwise).

Details

It is already linked (409 PAYMENT_TRANSACTION_LINKED) when those payments cover all it carries in that direction, or when a payment of this invoice is linked to it. A linked payment may be a refund (direction against the document's) and may settle a credit note. On an invoice brought over too (origin import or opening) the linked payment is recorded whatever the invoice's approval state: it records money that already moved and pays nothing out. A live invoice's payment, linked or not, needs its approval (APPROVAL_*). A caller holding ledger:write and invoices:write can record history that never passes approval; approval guards money going out, not booked history. On a document in another currency the payment is in the book currency (amount the euros that moved, the allocation what it settled) or in the document's (the journal's bank lines are then the euros), and is the transaction's only payment. Its rate and book figures are the app's own settlement when the journal booked exactly that (its receivable or payable the book value released, its bank the euros), else read off the journal; refused (400 PAYMENT_TRANSACTION_NOT_LINKABLE) when the journal cannot be read as the payment's booking.

external_refstring · nullableat most 200 characters

Your own id for this record (from the system you migrate from or sync with), unique per organization and resource.

on_conflictOnConflictdefault "error"

What a create does when a record of the same resource already holds the sent external_ref. error: 409 EXTERNAL_REF_EXISTS with existing_id. return: 200 with the existing record, unchanged.

One of error, return, update

Details

update: apply the sent fields to it as a PATCH would and answer 200; refused like a PATCH when the record is no longer editable.

Responses

errors use the error envelope
200Payment · An existing payment with this external_ref (on_conflict return).
201Payment · The recorded payment.
400The request fails validation. This operation's own codes: BANK_ACCOUNT_NOT_FOUND, DEFAULT_AP_ACCOUNT_NOT_CONFIGURED, DEFAULT_AR_ACCOUNT_NOT_CONFIGURED, DEFAULT_BANK_ACCOUNT_NOT_CONFIGURED, DEFAULT_CASH_ACCOUNT_NOT_CONFIGURED, DIMENSION_PROHIBITED, DIMENSION_REQUIRED_MISSING, PAYMENT_AMOUNT_NOT_POSITIVE, PAYMENT_DIRECTION_MISMATCH, PAYMENT_EXCEEDS_BALANCE, PAYMENT_METHOD_REQUIRES_SETTLEMENT, PAYMENT_ON_CREDIT_NOTE, PAYMENT_ON_DRAFT, PAYMENT_ON_PREPAYMENT_INVOICE, PAYMENT_TRANSACTION_NOT_LINKABLE, PERIOD_NOT_FOUND_FOR_DATE.
401No token, an expired token, or a token for another audience (UNAUTHENTICATED).
402The organization's subscription is not active (SUBSCRIPTION_INACTIVE): the trial ended without a plan, a payment is overdue, the subscription was cancelled, or the accounting firm that paid for it stopped. context.reason says which (trial_ended, not_paid, cancelled, payer_stopped; accept values you do not know) and context.export_until the last day (ISO date) the organization's data can still be exported. Every operation is refused, reads included, except reading the current user and the organization and the data export. A retry unchanged fails the same way: an owner reopens the subscription in the app.
403Not allowed. This operation's own codes: APPROVAL_REQUIRED, PERIOD_HARD_GATED.
404Not found. This operation's own codes: INVOICE_NOT_FOUND, TRANSACTION_NOT_FOUND.
409Conflicts with the resource's state. This operation's own codes: DIMENSION_CONFIRM_REQUIRED, EXTERNAL_REF_EXISTS, EXTRA_MONTH_CONFIRM_REQUIRED, PAYMENT_INVOICE_NOT_ISSUED, PAYMENT_TRANSACTION_LINKED, PERIOD_CONFIRM_REQUIRED, WORK_MONTH_CONFIRM_REQUIRED. An API credential cannot confirm a month: a person confirms it in the app, then retry the request unchanged, with the same Idempotency-Key; context names the month, its price and currency.
429Rate limit exceeded (RATE_LIMITED). Wait Retry-After seconds.

Errors this operation can return

switch on code, never on message
CodeStatusWhen
IDEMPOTENCY_KEY_REUSED409Idempotency-Key: Reusing a key with a DIFFERENT body is a client bug, not a retry, and returns 409 IDEMPOTENCY_KEY_REUSED rather than the earlier response.
BANK_ACCOUNT_NOT_FOUND400That bank account no longer exists.
DEFAULT_AP_ACCOUNT_NOT_CONFIGURED400No default accounts-payable account is configured.
DEFAULT_AR_ACCOUNT_NOT_CONFIGURED400No default accounts-receivable account is configured.
DEFAULT_BANK_ACCOUNT_NOT_CONFIGURED400No default bank account is configured.
DEFAULT_CASH_ACCOUNT_NOT_CONFIGURED400No default cash account is configured.
DIMENSION_PROHIBITED400This dimension isn't allowed on this account.
DIMENSION_REQUIRED_MISSING400This account requires ‹dimension›.
20 more codes
PAYMENT_AMOUNT_NOT_POSITIVE400Payment amount must be greater than zero.
PAYMENT_DIRECTION_MISMATCH400The payment goes the wrong way for this invoice: a customer pays a sales invoice in, a supplier's invoice is paid out.
PAYMENT_EXCEEDS_BALANCE400Payment can't exceed the remaining balance.
PAYMENT_METHOD_REQUIRES_SETTLEMENT400An offset can't be recorded as a payment.
PAYMENT_ON_CREDIT_NOTE400A credit note can't take a payment.
PAYMENT_ON_DRAFT400A draft invoice can't take a payment.
PAYMENT_ON_PREPAYMENT_INVOICE400A prepayment invoice is paid by the receipt it was made from.
PERIOD_NOT_FOUND_FOR_DATE400No accounting period covers this date.
APPROVAL_REQUIRED403The record must be approved first.
PERIOD_HARD_GATED403This period is done and your role isn't permitted to write into it.
INVOICE_NOT_FOUND404That invoice no longer exists.
TRANSACTION_NOT_FOUND404That transaction no longer exists.
DIMENSION_CONFIRM_REQUIRED409This account is missing a required dimension.
EXTERNAL_REF_EXISTS409on_conflict: error: 409 EXTERNAL_REF_EXISTS with existing_id.
EXTRA_MONTH_CONFIRM_REQUIRED409This change falls outside the working month, so this month is billed separately.
PAYMENT_INVOICE_NOT_ISSUED409A payment can only be recorded once the purchase invoice is confirmed.
PERIOD_CONFIRM_REQUIRED409This changes figures already marked done for this period.
WORK_MONTH_CONFIRM_REQUIRED409This change starts the plan year's working month, so the working month must be confirmed first.
PAYMENT_TRANSACTION_NOT_LINKABLE400data.transaction_id: Its receivable (sales) or payable (purchase) lines must carry the amount in the payment's direction beyond the payments already linked to it in that direction (400 PAYMENT_TRANSACTION_NOT_LINKABLE otherwise).
PAYMENT_TRANSACTION_LINKED409data.transaction_id: It is already linked (409 PAYMENT_TRANSACTION_LINKED) when those payments cover all it carries in that direction, or when a payment of this invoice is linked to it.

Plus the general codes every operation can answer (UNAUTHENTICATED, RATE_LIMITED …): handle them once.