Payment received marks the Odoo invoice paid
Who this is for: finance teams who use Odoo for invoicing and get paid through a payment provider or a bank that can call a webhook, and who don’t want to book every payment by hand.
Before you start: an Odoo connection named odoo (see Connect Odoo), the company variable payments_owner, and a payment provider or bank integration that can send a webhook when a payment arrives.
What it does
Section titled “What it does”Your payment provider or bank calls a webhook when a payment arrives, with the payment’s id, the Odoo invoice number, the amount, the currency and, if it has them, the payment date and a reference. The workflow finds the confirmed customer invoice with that number in Odoo and checks that the payment fits it: the same currency, and no more than the amount still due. If it fits, it registers the payment on the invoice, the way the invoice’s Pay button does, with the payment date and a memo that names the payment. A payment below the amount due is registered as a part payment, and the invoice stays partly paid.
When the payment doesn’t fit, the workflow books nothing and emails the payments owner, so a person decides:
- No invoice with that number. For example a typo in the payment reference, or a draft invoice that was never confirmed.
- More than what is due. Odoo itself accepts a payment above the amount due without a warning, so the workflow checks this before it writes anything.
- Another currency. The workflow never converts amounts.
An invoice that is already paid is skipped without an email.
Each payment is booked once. The workflow remembers the ids of the last 500 payments it booked. When your provider sends the same event again, for example after a timeout on its side, the run reads nothing from Odoo and books nothing. Every payment it books has a memo that starts with Payment and the payment’s id, and before it books, the workflow checks whether the invoice already has a payment with that memo. So a payment is not booked twice even when Odoo booked it but its answer was lost, or when you replay a run, and no email then says it was not booked. Runs for payments wait for each other, so two deliveries at the same moment can’t both book. The payment step also checks that the amount due in Odoo is still what the workflow saw a moment earlier, and books nothing if it changed. Don’t change the memo of a payment the workflow booked: the memo is how it recognises the payment.
After the payment, Odoo usually shows the invoice as In payment until your bookkeeping matches it with the bank transaction, and Paid after that. With some accounting settings it is Paid at once. See Paid or In payment.
What it can access
Section titled “What it can access”odoo: a connection made from the Odoo template. It uses only the ready-made actionslibrary/odoo.find-invoice-by-number@v1, which only reads the invoice and its payments, andlibrary/odoo.register-payment@v1, which registers the payment. The bot user needs access to the Invoicing or Accounting app that may register payments, and nothing else.- It emails only
payments_owner, and only when a payment can’t be booked. The email names the invoice number, the payment id, the amount and the payment date. - It saves the ids of the last 500 payments it booked, nothing else. No secret value is ever in the workflow.
What you need to set up
Section titled “What you need to set up”- Create the Odoo connection from its template and name it
odoo. Give its bot user access to Invoicing or Accounting that may register payments (see Connect Odoo). - Add the company variable
payments_owner: who should get the emails about payments that were not booked (see Use company variables). - Point your payment provider’s or bank’s “payment received” event at the workflow’s webhook endpoint,
payment-received(see Set up a webhook). Ask it to sign its calls, and to send anIdempotency-Keyheader with each event. The body is JSON withpayment_id,invoice_number,amount(a number) andcurrency(likeEUR), and optionallypaid_on(like2026-11-17; default today’s date in Finland when the event arrives) andreference. - Take it into use from the Liitora library (see Take a library workflow into use), read the test cases on your copy, run them, start a dry run against a test database first, and approve it.
How to adapt it
Section titled “How to adapt it”- Find the invoice by its payment reference. If your customers pay with a structured bank reference that Odoo keeps as the invoice’s payment reference, change the
findstep’snumber:topayment_reference:. - Book overpayments anyway. Odoo accepts them, but the difference then needs a person in accounting. Keep the email, and add the amount to the email text, rather than removing the check.
- A different payload. If your provider sends other field names, change the
checkstep’s script, which reads the event and refuses anything it doesn’t understand. - Your bank journal. The payment goes to Odoo’s default journal. To use another one, add
journal_idto thepaystep.
What Liitora shows on the approval page
Section titled “What Liitora shows on the approval page”When the payment-received webhook is called, read the payments already booked, then check the payment event. Depending on that result, find the invoice in Odoo, then decide whether the payment fits the invoice. Depending on that result, register the payment on the invoice and email the payments owner about a payment that was not booked, then remember that this payment is booked.
Trust details
Section titled “Trust details”| What | Details |
|---|---|
| Publisher | Liitora |
| Version | 1.0.0 |
| Licence | Apache-2.0 |
| Content hash | sha256:34d7d11c1713a6ce26ca9a3e1c81ca937f1149e6d319da6bc37bbbe5bbbe5c02 |
| Tests | 13 |
| Connections | odoo |
| Company variables | payments_owner |
| Secrets | None |
| Personal data | The invoice number, the customer’s name as Odoo shows it on the invoice, the amount and the payment reference, sent to the payments owner when a payment can’t be booked. |
| Saved state | Yes |
| Runs on your own runner | No |
| Actions | library/odoo.find-invoice-by-number@v1, library/odoo.register-payment@v1, platform/email.send@v1, platform/state.get@v1, platform/state.set@v1, platform/transform@v1 |
Liitora signs each version of this workflow. When your company takes it into use, Liitora checks the content hash and the signature again before it copies the workflow into your company. See How the library is kept safe.
The full YAML
Section titled “The full YAML”# A Liitora library workflow (see the guide, Library > Payment received marks the Odoo invoice paid).# Connection used: odoo (from the Odoo template). Company variable used:# payments_owner. Saved state: the ids of the last 500 payments booked, so# the same payment event arriving twice books one payment only.name: Payment received marks the Odoo invoice paiddescription: When a payment provider or bank reports a payment, find the confirmed Odoo invoice by its number and register the payment on it. Books nothing and emails the payments owner when the invoice is missing, the currency differs or the amount is more than what is due. Skips invoices that are already paid and payments it has already booked.
on: webhook: endpoint: payment-received
# One payment at a time, so two deliveries of the same event can't both# see the invoice as unpaid.concurrency: group: odoo-payments cancel_in_progress: false
steps: - id: seen name: Read the payments already booked uses: platform/state.get@v1 with: key: booked_payment_ids default: []
- id: check name: Check the payment event needs: [seen] uses: platform/transform@v1 with: input: body: ${{ trigger.body }} seen: ${{ steps.seen.outputs.value }} # Today in Finland, for a payment that comes without its date. today: ${{ format_date(now(), '%Y-%m-%d', 'Europe/Helsinki') }} script: | const b = input.body; if (b === null || typeof b !== "object" || Array.isArray(b)) { throw new Error("The payment event must be a JSON object."); } const id = typeof b.payment_id === "number" ? String(b.payment_id) : typeof b.payment_id === "string" ? b.payment_id.trim() : ""; if (!/^[A-Za-z0-9._:-]{1,64}$/.test(id)) { throw new Error("payment_id must be 1 to 64 letters, digits, dots, dashes, underscores or colons."); } const number = typeof b.invoice_number === "string" ? b.invoice_number.trim() : ""; if (number.length === 0 || number.length > 100) { throw new Error("invoice_number must be the Odoo invoice number, like INV/2026/00010."); } if (typeof b.amount !== "number" || !isFinite(b.amount) || b.amount <= 0 || b.amount > 1e12) { throw new Error("amount must be a number above 0."); } const currency = typeof b.currency === "string" ? b.currency.trim().toUpperCase() : ""; if (!/^[A-Z]{3}$/.test(currency)) { throw new Error("currency must be a three-letter currency code, like EUR."); } let paidOn = input.today; if (b.paid_on !== undefined && b.paid_on !== null) { if (typeof b.paid_on !== "string" || !/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/.test(b.paid_on)) { throw new Error("paid_on must be a date like 2026-11-17."); } paidOn = b.paid_on; } const reference = typeof b.reference === "string" ? b.reference.trim().slice(0, 200) : ""; const seen = Array.isArray(input.seen) ? input.seen.filter((x) => typeof x === "string") : []; return { payment_id: id, invoice_number: number, amount: Math.round(b.amount * 100) / 100, currency: currency, paid_on: paidOn, memo: reference.length > 0 ? "Payment " + id + ", " + reference : "Payment " + id, duplicate: seen.indexOf(id) >= 0, remember: [id].concat(seen.filter((x) => x !== id)).slice(0, 500), };
- id: find name: Find the invoice in Odoo needs: [check] if: ${{ steps.check.outputs.result.duplicate == false }} uses: library/odoo.find-invoice-by-number@v1 connections: odoo: odoo with: number: ${{ steps.check.outputs.result.invoice_number }} # Also look for a payment on the invoice with this payment's memo, so # a payment booked by an earlier run that lost Odoo's answer, or one # older than the remembered ids, is never booked again. payment_memo: ${{ steps.check.outputs.result.memo }} retry: attempts: 3 backoff: exponential on: [429, 5xx, timeout, network]
- id: decide name: Decide whether the payment fits the invoice needs: [find] uses: platform/transform@v1 with: input: payment: ${{ steps.check.outputs.result }} found: ${{ steps.find.outputs.found }} invoice: ${{ steps.find.outputs.invoice }} booked: ${{ steps.find.outputs.payment_with_memo }} script: | const p = input.payment; const inv = input.invoice; const label = p.invoice_number; const result = (action, reason, extra) => Object.assign({ action: action, reason: reason, invoice_id: null, amount_due: null, partial: false }, extra || {}); if (input.found !== true || inv === null || typeof inv !== "object") { return result("alert", "Odoo has no confirmed customer invoice with the number " + label + ", so nothing was booked."); } // Checked before the amounts: once this payment is booked, the // amount due is lower and the payment could look like too much. if (input.booked !== null && typeof input.booked === "object") { return result("skip", "Payment " + p.payment_id + " is already booked on invoice " + label + " in Odoo."); } if (inv.paid === true || inv.in_payment === true) { return result("skip", "Invoice " + label + " is already paid in Odoo."); } const currency = typeof inv.currency === "string" ? inv.currency.trim().toUpperCase() : ""; if (currency !== p.currency) { return result("alert", "The payment is in " + p.currency + ", but invoice " + label + " is in " + (currency || "a currency Odoo did not report") + ", so nothing was booked."); } const due = typeof inv.amount_due === "number" ? inv.amount_due : null; if (due === null) { return result("alert", "Odoo did not report the amount due on invoice " + label + ", so nothing was booked."); } if (due <= 0.005) { return result("skip", "Nothing is due on invoice " + label + "."); } if (p.amount > due + 0.005) { return result("alert", "The payment of " + p.amount + " " + p.currency + " is more than the " + due + " " + p.currency + " still due on invoice " + label + ", so nothing was booked. Book it in Odoo by hand and decide what to do with the difference."); } return result("pay", "", { invoice_id: inv.id, amount_due: due, partial: p.amount < due - 0.005 });
- id: pay name: Register the payment on the invoice needs: [decide] if: ${{ steps.decide.outputs.result.action == 'pay' }} uses: library/odoo.register-payment@v1 connections: odoo: odoo with: invoice_id: ${{ steps.decide.outputs.result.invoice_id }} amount: ${{ steps.check.outputs.result.amount }} expected_amount_due: ${{ steps.decide.outputs.result.amount_due }} payment_date: ${{ steps.check.outputs.result.paid_on }} memo: ${{ steps.check.outputs.result.memo }}
- id: remember name: Remember that this payment is booked needs: [pay] uses: platform/state.set@v1 with: key: booked_payment_ids value: ${{ steps.check.outputs.result.remember }}
- id: alert name: Email the payments owner about a payment that was not booked needs: [decide] if: ${{ steps.decide.outputs.result.action == 'alert' }} uses: platform/email.send@v1 with: to: ["${{ vars.payments_owner }}"] subject: "Payment not booked in Odoo: ${{ steps.check.outputs.result.invoice_number }}" text: "${{ steps.decide.outputs.result.reason }} Payment ${{ steps.check.outputs.result.payment_id }}: ${{ steps.check.outputs.result.amount }} ${{ steps.check.outputs.result.currency }}, paid on ${{ steps.check.outputs.result.paid_on }}."Changelog
Section titled “Changelog”- 1.0.0 (2026-11-17): First version in the library.