What GoCardless says
| Reason | Type | GoCardless text |
|---|---|---|
refund_payment_invalid_state | invalid_state | Payment 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.”.

The timing rules at a glance
| Days since the charge | GoCardless, by default | The connector |
|---|---|---|
| Less than 2 | within the safer period: returns an error | does not send the refund |
| 2 or more, but less than 7 | within the safer period: returns an error | sends it and leaves a notice in the server log |
| 7 or more | outside the safer period | sends 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
- 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.”.
- 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. - 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 (…).”.

What to do
- 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.
- 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. - If the rejection comes from the safer period, wait until 7 days have passed since the charge date, or ask GoCardless to remove it.
- 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
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)
