Skip to content

Export client vouchers to an ERP

A voucher is the accounting entry that Quiddly books for a business event on a client. An ERP integration reads the vouchers that wait for export, books them in the ERP, and reports the result back to Quiddly one voucher at a time. This page covers that loop. To produce an SIE file for the period instead, see Export internal bookkeeping.

  • A token that is bound to the client. Both read calls answer 400 Only client user are allowed to access this resource for a system-level token. Request a token for the client as described under Several clients.
  • The rights for each call, listed in the table below. See the Rights catalogue.
  • A voucher that is ready. A voucher is listed when its status is PENDING_EXPORT or NOT_CONNECTED and its export method is automatic.
CallRight
GET /vouchers/external/export/paymentsReadVouchersExternalExportPayments
GET /vouchers/external/export/vouchersReadVouchersExternalExportVouchers
PUT /vouchers/<id>/external/exportExportExternalVouchers
PUT /vouchers/<id>/external/bookkeepExternalBookkeepVouchers
PUT /vouchers/<id>/external/failExternalFailVouchers

Both read calls are paged, see Pagination and search.

The client’s bookkeeping settings decide how payments are exported. Read export.invoicePaymentMethod with GET /clients/<id>/settings/bookkeeping, see Client bookkeeping settings.

invoicePaymentMethodWhat to read
PAYMENTPayments from GET /vouchers/external/export/payments, which returns one row for each payment-type voucher: CLIENT_PAYMENT, CLIENT_PAYMENT_DIRECT, CLIENT_PAYMENT_WRITEOFF, CLIENT_INVOICE_CREDITED and CLIENT_CREDIT_INVOICE_CREDITED. All other vouchers come from GET /vouchers/external/export/vouchers, which leaves those five types out.
VOUCHERAll vouchers from GET /vouchers/external/export/vouchers. The payments call returns an empty list.

Prefer the payments call for payments: each row is flat, with paymentDate, amount, amountLocale, invoiceNumber, invoiceCurrency, baseCurrency, the debtor name, externalPaymentMethodCode, accountNumber and accountCode, and carries no postings to interpret. Both calls leave out the voucher types that the client has switched off in the export flags of its bookkeeping settings (invoiceActivation, invoicePayment, invoicePaymentTolerance, invoiceRecourse, payout and bill).

A voucher has a series, which is the voucher series of the client’s bookkeeping settings. The vouchers call lists, for each voucher, its type, topic, transactionDate, description, its documents and its postings.

  1. Mark the voucher exported when you have fetched it, with PUT /vouchers/<id>/external/export and the body { "externalId": "..." }. For a payment row, the id is the id of its voucher. It works while the voucher is PENDING_EXPORT, NOT_CONNECTED or SENT, otherwise it answers 400. The voucher is now EXPORTED and drops out of the read calls.

  2. Mark it booked when the ERP has booked it, with PUT /vouchers/<id>/external/bookkeep and the body { "externalInformationId": "...", "externalInformationSeries": "...", "externalInformationFinancialYearId": "..." }. It works only for an EXPORTED or SENT voucher. The voucher is now BOOKED.

  3. Mark it failed when the ERP rejects it, with PUT /vouchers/<id>/external/fail and the body { "errorMessage": "..." }. It works only for an EXPORTED voucher. The voucher is now FAILED_BOOKED and keeps your message.

Terminal window
curl -X PUT "https://$HOST/vouchers/$VOUCHER_ID/external/export" \
-H "Authorization: Bearer $CLIENT_JWT" -H "Content-Type: application/json" \
-d '{ "externalId": "ERP-4711" }'

Each of the three calls answers 204.

The debits and the credits of a voucher can differ by a few cents. When they differ by 0.01 to 0.05 in the base currency, or in the original currency, Quiddly adds a posting on the round-off account to balance the voucher. A larger difference is not balanced.

The round-off posting is a posting like the others in postings, with accountCode ROUNDOFF. The difference can exist in only one of the two currencies, so the posting can have debit and credit of 0.00 while debitOriginalCurrency or creditOriginalCurrency holds the difference, or the reverse. If you export the vouchers with their postings, check which pair of amounts your ERP books, and skip the postings that have zero in that pair before you send the voucher on.