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.
Prerequisites
Section titled “Prerequisites”- A token that is bound to the client. Both read calls answer
400 Only client user are allowed to access this resourcefor 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_EXPORTorNOT_CONNECTEDand its export method is automatic.
| Call | Right |
|---|---|
GET /vouchers/external/export/payments | ReadVouchersExternalExportPayments |
GET /vouchers/external/export/vouchers | ReadVouchersExternalExportVouchers |
PUT /vouchers/<id>/external/export | ExportExternalVouchers |
PUT /vouchers/<id>/external/bookkeep | ExternalBookkeepVouchers |
PUT /vouchers/<id>/external/fail | ExternalFailVouchers |
Both read calls are paged, see Pagination and search.
Choose the endpoint
Section titled “Choose the endpoint”The client’s bookkeeping settings decide how payments are exported. Read
export.invoicePaymentMethod with GET /clients/<id>/settings/bookkeeping, see
Client bookkeeping settings.
invoicePaymentMethod | What to read |
|---|---|
PAYMENT | Payments 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. |
VOUCHER | All 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.
Report the result
Section titled “Report the result”-
Mark the voucher exported when you have fetched it, with
PUT /vouchers/<id>/external/exportand the body{ "externalId": "..." }. For a payment row, theidis the id of its voucher. It works while the voucher isPENDING_EXPORT,NOT_CONNECTEDorSENT, otherwise it answers400. The voucher is nowEXPORTEDand drops out of the read calls. -
Mark it booked when the ERP has booked it, with
PUT /vouchers/<id>/external/bookkeepand the body{ "externalInformationId": "...", "externalInformationSeries": "...", "externalInformationFinancialYearId": "..." }. It works only for anEXPORTEDorSENTvoucher. The voucher is nowBOOKED. -
Mark it failed when the ERP rejects it, with
PUT /vouchers/<id>/external/failand the body{ "errorMessage": "..." }. It works only for anEXPORTEDvoucher. The voucher is nowFAILED_BOOKEDand keeps your message.
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.
Round-off postings
Section titled “Round-off postings”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.