Skip to main content
GoCardless API · invalid_state · refunds

GoCardless refund_payment_invalid_state: this collection cannot be refunded yet

A GoCardless refund returns a collection's money to the customer, and GoCardless only accepts it if that collection is confirmed or already paid out. Otherwise it responds refund_payment_invalid_state. GoCardless also has a 7-calendar-day safer refund period, and the Odoo connector adds its own 2-day rule.

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

ReasonTypeGoCardless text
refund_payment_invalid_stateinvalid_statePayment must be confirmed or paid_out before it can be refunded.

In the refunds reference, GoCardless adds a time limit: “A refund can only be created once it is outside the safer refund period (7 calendar days after the charge date) otherwise an error is returned.”. That period can be removed: “The safer refund period can be disabled by contacting GoCardless.”. And it explains why it exists: “A payment that has been (partially) refunded can still receive a late failure or chargeback from the customer's bank.”.

Refunds through the API, moreover, come switched off: “This endpoint is disabled by default. To enable it, you will need to enable refunds on your GoCardless Dashboard.”.

GoCardless refund_payment_invalid_state error card
The reason, its invalid_state type, and the confirmed and paid_out statuses GoCardless requires to refund.

The timing rules at a glance

Days since the chargeGoCardless, by defaultThe connector
Less than 2within the safer period: returns an errordoes not send the refund
2 or more, but less than 7within the safer period: returns an errorsends it and leaves a notice in the server log
7 or moreoutside the safer periodsends it

The two do not count from the same point. GoCardless counts from the payment's charge date. The connector counts from the last status change of the collection's transaction in Odoo. If GoCardless has removed the safer period, between 2 and 7 days the refund may go through.

When refund_payment_invalid_state appears with the connector

Odoo only lets you refund a confirmed transaction, and the connector confirms it when GoCardless says confirmed or paid_out. So with the connector, this reason means the payment has changed in GoCardless and Odoo does not know yet: a late failure, which GoCardless may report after the payment was already confirmed, or a customer refund whose event has not arrived yet.

What the connector does

  1. With less than 2 days, it sends nothing: Odoo stops with “GoCardless cannot refund a collection until it has settled. This one was charged … day(s) ago; refunds are possible after 2 days.”.
  2. Otherwise, it sends the refund to GoCardless with its idempotency key. If GoCardless rejects it, for this reason, for the safer period, or for any other reason, the refund transaction moves to “Error” with “GoCardless rejected the request.” and, below it, GoCardless's message with the reason and the request_id.
  3. If it accepts, the transaction stays “Pending” with “Refund submitted. GoCardless will deduct it from a future payout.”, and moves to “Confirmed” when GoCardless pays it out or deducts it from a payout.

Since version 1.1.5, a refund in error does not show the “Retry collection” button: a refund is not a collection, and there is nothing GoCardless can retry. If GoCardless cannot get the money back to the customer, the connector moves the refund to error with “GoCardless could not pay this refund back (…).”. 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 pay this refund back (…).”.

Diagram: what GoCardless responds to a refund and what Odoo does with the connector
Diagram based on the connector's code (17.0, 18.0, 19.0 and 20.0) and the GoCardless documentation.

What to do

  1. Open the collection's transaction from the invoice, using the “Payment Transaction” button at the top; the transactions menu only appears in developer mode, and does not exist in Odoo 20. From there, the refunds button takes you to the refund transaction and its message.
  2. If the reason is refund_payment_invalid_state, check the payment in the GoCardless Dashboard. If it failed late or the customer returned it, there is nothing to refund: the money is no longer with you. Odoo will reflect it when the event arrives; the scheduled task that recovers lost events every hour brings it in.
  3. If the rejection comes from the safer period, wait until 7 days have passed since the charge date, or ask GoCardless to remove it.
  4. To refund again, do it from the collection's payment, with its refund button. The connector supports partial refunds.

Why does the connector allow refunds from 2 days if GoCardless talks about 7?

The 2 days are the connector's minimum: below that it sends nothing. GoCardless lets you remove its safer period, and while it is active it is GoCardless that rejects the refund before 7 days. Between 2 and 7 days the connector warns in the log, because a SEPA failure can still arrive.

Can a refunded collection still fail later?

Yes. GoCardless warns that a payment refunded, in full or in part, can still receive a late failure or a chargeback from the customer's bank. In that case you would have returned money you did not end up keeping.

With our connector

In Odoo 17, 18, 19 and 20 the connector does not send refunds for collections less than 2 days old, leaves in error with its request_id the ones GoCardless rejects, and does not offer to retry a refund, since a refund is not a collection.

Keep reading

GoCardless total_amount_confirmation_invalid: the total refunded does not matchGoCardless rejects a refund with total_amount_confirmation_invalid if the total refunded does not match, or with number_of_refunds_exceeded after 5.GoCardless MD06: the customer asks their bank to refund a collectionThe customer asks their bank to refund a GoCardless direct debit: charged_back, refund_requested and MD06. What happens to the invoice and the mandate in Odoo.GoCardless insufficient_funds (AM04): the customer's account had no fundsA GoCardless direct debit fails with insufficient_funds and SEPA code AM04. What it means, when Success+ retries it, and what Odoo does with the invoice.
Checked in the connector's source code (version 17.0, 18.0, 19.0 and 20.0) and the linked sources

Sources

  • docs.gocardless.com/docs/api-reference/responses-and-errors
  • docs.gocardless.com/docs/api-reference/refund
  • support.gocardless.com/hc/en-gb/articles/360001467265
  • Module source code: flexigo_payment_gocardless: const.py, line 41 in 17.0 (d203ee6), 18.0 (e2ab18b), 19.0 (ce7f5a3) and 20.0 (688d86b)
  • github.com/odoo/odoo/blob/20.0/addons/payment/models/payment_transaction.py
  • github.com/odoo/odoo/blob/20.0/addons/account_payment/views/account_payment_views.xml
  • Module source code: flexigo_payment_gocardless: models/payment_provider.py, line 256 in 17.0 (d203ee6), 18.0 (e2ab18b), 19.0 (ce7f5a3) and 20.0 (688d86b)
  • Module source code: flexigo_payment_gocardless: const.py, line 106 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 361 in 17.0 (d203ee6), line 361 in 18.0 (e2ab18b), line 360 in 19.0 (ce7f5a3) and line 375 in 20.0 (688d86b)
  • Module source code: flexigo_payment_gocardless: models/payment_transaction.py, line 365 in 17.0 (d203ee6), line 365 in 18.0 (e2ab18b), line 364 in 19.0 (ce7f5a3) and line 379 in 20.0 (688d86b)
  • Module source code: flexigo_payment_gocardless: i18n/flexigo_payment_gocardless.pot, line 414 in 17.0 (d203ee6), line 414 in 18.0 (e2ab18b), line 414 in 19.0 (ce7f5a3) and line 416 in 20.0 (688d86b)
  • Module source code: flexigo_payment_gocardless: models/payment_transaction.py, line 371 in 17.0 (d203ee6), line 371 in 18.0 (e2ab18b), line 370 in 19.0 (ce7f5a3) and line 385 in 20.0 (688d86b)
  • Module source code: flexigo_payment_gocardless: models/payment_transaction.py, line 397 in 17.0 (d203ee6), line 397 in 18.0 (e2ab18b), line 396 in 19.0 (ce7f5a3) and line 411 in 20.0 (688d86b)
  • Module source code: flexigo_payment_gocardless: models/payment_provider.py, line 397 in 17.0 (d203ee6), 18.0 (e2ab18b), 19.0 (ce7f5a3) and 20.0 (688d86b)
  • Module source code: flexigo_payment_gocardless: models/payment_provider.py, line 462 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 521 in 17.0 (d203ee6), line 521 in 18.0 (e2ab18b), line 521 in 19.0 (ce7f5a3) and line 523 in 20.0 (688d86b)
  • Module source code: flexigo_payment_gocardless: models/payment_transaction.py, line 413 in 17.0 (d203ee6), line 413 in 18.0 (e2ab18b), line 412 in 19.0 (ce7f5a3) and line 427 in 20.0 (688d86b)
  • Module source code: flexigo_payment_gocardless: models/payment_transaction.py, line 605 in 17.0 (d203ee6), line 605 in 18.0 (e2ab18b), line 604 in 19.0 (ce7f5a3) and line 625 in 20.0 (688d86b)
  • Module source code: flexigo_payment_gocardless: models/payment_provider.py, line 352 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 987 in 17.0 (d203ee6), line 987 in 18.0 (e2ab18b), line 987 in 19.0 (ce7f5a3) and line 1002 in 20.0 (688d86b)
  • Module source code: flexigo_payment_gocardless: models/payment_transaction.py, line 611 in 17.0 (d203ee6), line 611 in 18.0 (e2ab18b), line 610 in 19.0 (ce7f5a3) and line 631 in 20.0 (688d86b)
  • Module source code: flexigo_payment_gocardless: i18n/flexigo_payment_gocardless.pot, line 442 in 17.0 (d203ee6), line 442 in 18.0 (e2ab18b), line 442 in 19.0 (ce7f5a3) and line 444 in 20.0 (688d86b)
  • Module source code: flexigo_payment_gocardless: models/payment_transaction.py, line 424 in 17.0 (d203ee6), line 424 in 18.0 (e2ab18b), line 423 in 19.0 (ce7f5a3) and line 438 in 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: 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: const.py, line 117 in 17.0 (d203ee6), 18.0 (e2ab18b), 19.0 (ce7f5a3) and 20.0 (688d86b)
  • github.com/odoo/odoo/blob/20.0/addons/payment/i18n/payment.pot
  • github.com/odoo/odoo/blob/20.0/addons/account_payment/views/account_move_views.xml
  • github.com/odoo/odoo/blob/17.0/odoo/http.py
  • Module source code: flexigo_payment_gocardless: __manifest__.py, line 31 in 17.0 (d203ee6), 18.0 (e2ab18b), 19.0 (ce7f5a3) and 20.0 (688d86b)