Skip to main content
GoCardless · SEPA Core · failed payment and cancelled mandate

GoCardless bank_account_closed: AC04 and MD07, the account no longer exists

bank_account_closed is a failure with no way back: the account where the customer signed the mandate is closed, or its holder has died. GoCardless reports it on the failed payment and on the mandate, which is cancelled. No retry fixes it.

FlexigoTech · Editor in charge: Víctor Gómez · Updated 6 November 2026

Key facts

Versions
Odoo 17, 18, 19 and 20
Checked
in the connector's source code, version 17.0, 18.0, 19.0 and 20.0 · against the sources linked at the end
Reading time
4 min

What GoCardless says

EventSEPA Core codeGoCardless text
payments · failedAC04The bank account for this payment has been closed. The mandate will also be cancelled.
payments · failedMD07This payment failed because the customer is deceased.
mandates · cancelledAC04The bank account for this mandate has been closed. Any subscriptions and pending payment will also be cancelled.
mandates · cancelledMD07This mandate has been cancelled because the customer is deceased.

The cause is the same in all four rows, bank_account_closed; the code tells the reason apart. Note the third one: besides the mandate, GoCardless cancels the pending payments of that mandate, which will reach you as cancelled payments with the same cause.

GoCardless bank_account_closed cause card
The cause, its codes AC04 and MD07 and GoCardless's text for AC04.

Two events for the same fact

An account closure reaches Odoo twice: with the failed payment and with the mandate being cancelled. The connector handles both: the first one to arrive archives the mandate and notifies, and the second one finds it already archived, without repeating the notice. If either does not arrive through the webhook, the scheduled task that asks GoCardless every hour for missed events recovers it, up to 100 per run.

What the connector does

  1. Sets the transaction to error with “GoCardless could not collect this payment (bank_account_closed).” and stores the cause.
  2. If the invoice was already paid with that collection, cancels the payment in Odoo and the invoice becomes outstanding again.
  3. Archives the customer's payment method: bank_account_closed is one of the four causes for which the connector treats the mandate as dead, together with mandate_cancelled, mandate_expired and authorisation_disputed.
  4. Writes it on the customer's record: “The GoCardless direct debit mandate of … is no longer usable (bank_account_closed). No further collection can be taken against it. Ask the customer to set up a new mandate.”
  5. Creates an activity “GoCardless mandate lost” so that someone deals with it before the next invoice.

The archived mandate stays in Odoo as history, but is no longer offered for collection. The transaction is opened from the invoice, with the “Payment Transaction” button at the top; the transactions menu only appears in developer mode, and does not exist in Odoo 20.

These three texts are written by the connector when applying the event, with nobody in front. The connector writes these texts in English, so in an English-language Odoo they appear exactly as quoted here, whether a user or a scheduled action triggers them: “GoCardless could not collect this payment (bank_account_closed).”, “The GoCardless direct debit mandate of … is no longer usable (bank_account_closed). No further collection can be taken against it. Ask the customer to set up a new mandate.” and “GoCardless mandate lost”.

How to tell whether it is AC04 or MD07

From Odoo you cannot tell. The cause is the same, the connector stores the cause and not the SEPA code, and the customer note and the activity say the same in both cases. You see the code in GoCardless. According to its help centre, the reason for each failure appears in the payment's status timeline, in the Dashboard (“You are able to view the reason for a payment failure in the status timeline of the payment in your GoCardless dashboard.”). In advanced mode, the exact code also goes in the event (details.reason_code), and the Dashboard keeps the deliveries of the last 3 months under Developers > Webhooks, with their content.

If the code is MD07

MD07 is not a technical problem. The account holder has died and the mandate is cancelled. Pending invoices of that customer will not be collected by direct debit, and how to claim them is a matter for your accountant, not the connector. It is prudent to review their scheduled collections and subscriptions in Odoo so that no more are generated. Odoo's note asks for a new mandate in this case too, because it only knows the cause: with MD07, do not ask for one.

What to do with AC04

  • Contact the customer: they have a new account, or will have one, and need to sign a mandate with it.
  • When they sign, the new mandate will be another payment method in Odoo; the old one stays archived.
  • Collect the outstanding invoices with the new mandate.
Diagram: what GoCardless sends with bank_account_closed and what Odoo does with the connector
Diagram based on the connector's code (17.0, 18.0, 19.0 and 20.0) and on GoCardless's documentation.

Can I retry a payment with bank_account_closed?

It makes no sense: the account does not exist. Moreover, the connector archives the mandate, and with the mandate archived the “Retry collection” button does not appear on the transaction.

And if the customer changed bank with the account transfer service?

That is not a closure: GoCardless reports it as a transferred mandate, with the cause bank_account_transferred, and the mandate remains valid.

With our connector

The GoCardless connector for Odoo 17, 18, 19 and 20 does with bank_account_closed what an attentive person would do: marks the collection as failed, reopens the invoice, removes the dead mandate so that nobody uses it again, and leaves a notice with the cause on the customer's record.

Keep reading

GoCardless invalid_bank_details: AC01 and BE06, the bank account specified does not existGoCardless invalid_bank_details with AC01 or BE06: the mandate's bank account does not exist. Why it appears and what Odoo does with the connector.GoCardless direct_debit_not_enabled: AG01 and AC06, an account that does not accept direct debitGoCardless direct_debit_not_enabled with AG01 or AC06: the customer's account does not accept SEPA direct debits, or is blocked. What Odoo does next.GoCardless mandate_is_inactive error when creating a collection from OdooGoCardless returns mandate_is_inactive when a payment is created against a cancelled, failed or expired mandate. Why it happens and how Odoo handles it.
Checked in the connector's source code (version 17.0, 18.0, 19.0 and 20.0) and the linked sources

Sources

  • Module source code: flexigo_payment_gocardless: const.py, line 15 in 17.0 (d203ee6), 18.0 (e2ab18b), 19.0 (ce7f5a3) and 20.0 (688d86b)
  • Module source code: flexigo_payment_gocardless: models/payment_transaction.py, line 442 in 17.0 (d203ee6), line 442 in 18.0 (e2ab18b), line 441 in 19.0 (ce7f5a3) and line 456 in 20.0 (688d86b)
  • Module source code: flexigo_payment_gocardless: models/payment_token.py, line 83 in 17.0 (d203ee6), line 83 in 18.0 (e2ab18b), line 83 in 19.0 (ce7f5a3) and line 82 in 20.0 (688d86b)
  • Module source code: flexigo_payment_gocardless: const.py, line 145 in 17.0 (d203ee6), 18.0 (e2ab18b), 19.0 (ce7f5a3) and 20.0 (688d86b)
  • docs.gocardless.com/docs/api-reference/events/mandate
  • Module source code: flexigo_payment_gocardless: const.py, line 76 in 17.0 (d203ee6), 18.0 (e2ab18b), 19.0 (ce7f5a3) and 20.0 (688d86b)
  • Module source code: flexigo_payment_gocardless: const.py, line 33 in 17.0 (d203ee6), 18.0 (e2ab18b), 19.0 (ce7f5a3) and 20.0 (688d86b)
  • Module source code: flexigo_payment_gocardless: models/payment_token.py, line 131 in 17.0 (d203ee6), line 131 in 18.0 (e2ab18b), line 131 in 19.0 (ce7f5a3) and line 130 in 20.0 (688d86b)
  • Module source code: flexigo_payment_gocardless: models/payment_transaction.py, line 725 in 17.0 (d203ee6), line 725 in 18.0 (e2ab18b), line 724 in 19.0 (ce7f5a3) and line 748 in 20.0 (688d86b)
  • Module source code: flexigo_payment_gocardless: models/payment_transaction.py, line 754 in 17.0 (d203ee6), line 754 in 18.0 (e2ab18b), line 753 in 19.0 (ce7f5a3) and line 777 in 20.0 (688d86b)
  • Module source code: flexigo_payment_gocardless: const.py, line 117 in 17.0 (d203ee6), 18.0 (e2ab18b), 19.0 (ce7f5a3) and 20.0 (688d86b)
  • Module source code: flexigo_payment_gocardless: i18n/flexigo_payment_gocardless.pot, line 436 in 17.0 (d203ee6), line 436 in 18.0 (e2ab18b), line 436 in 19.0 (ce7f5a3) and line 438 in 20.0 (688d86b)
  • Module source code: flexigo_payment_gocardless: i18n/flexigo_payment_gocardless.pot, line 1148 in 17.0 (d203ee6), line 1148 in 18.0 (e2ab18b), line 1148 in 19.0 (ce7f5a3) and line 1155 in 20.0 (688d86b)
  • Module source code: flexigo_payment_gocardless: i18n/flexigo_payment_gocardless.pot, line 495 in 17.0 (d203ee6), line 495 in 18.0 (e2ab18b), line 495 in 19.0 (ce7f5a3) and line 497 in 20.0 (688d86b)
  • Module source code: flexigo_payment_gocardless: __manifest__.py, line 31 in 17.0 (d203ee6), 18.0 (e2ab18b), 19.0 (ce7f5a3) and 20.0 (688d86b)
  • docs.gocardless.com/docs/api-reference/events/payment
  • Module source code: flexigo_payment_gocardless: views/payment_transaction_views.xml, line 13 in 17.0 (d203ee6), 18.0 (e2ab18b), 19.0 (ce7f5a3) and 20.0 (688d86b)
  • Module source code: flexigo_payment_gocardless: models/payment_transaction.py, line 63 in 17.0 (d203ee6), 18.0 (e2ab18b), 19.0 (ce7f5a3) and 20.0 (688d86b)
  • Module source code: flexigo_payment_gocardless: models/payment_transaction.py, line 418 in 17.0 (d203ee6), line 418 in 18.0 (e2ab18b), line 417 in 19.0 (ce7f5a3) and line 432 in 20.0 (688d86b)
  • Module source code: flexigo_payment_gocardless: i18n/flexigo_payment_gocardless.pot, line 1016 in 17.0 (d203ee6), line 1016 in 18.0 (e2ab18b), line 1016 in 19.0 (ce7f5a3) and line 1031 in 20.0 (688d86b)
  • docs.gocardless.com/docs/api-reference/webhooks
  • github.com/odoo/odoo/blob/17.0/odoo/http.py
  • support.gocardless.com/hc/en-gb/articles/360001467265
  • Module source code: flexigo_payment_gocardless: const.py, line 66 in 17.0 (d203ee6), 18.0 (e2ab18b), 19.0 (ce7f5a3) and 20.0 (688d86b)
  • github.com/odoo/odoo/blob/20.0/addons/account_payment/views/account_move_views.xml