HOME / COMMUNITY Switch to knowledge base

API with GoCardless - how do I work out if a day is a bank holiday?

We want to get bank holidays to prevent direct debit failure on specified collection date. We have checked api functions but not found any. Could you please provide us way to find out if specified collection date is a holiday or not? Do you provide any api function to get bank holidays?

in some places I found that - " if that date falls on a bank holiday or weekend, then it will be the next possible date." but this never works

We always collect direct debits on Friday,

Thank you

Hi @Paul_Cheetham

There isn’t a function offered by QuickFile, nor GoCardless (as far as I’m aware) to check if a date is a bank holiday or not. If you have a link directly with GoCardless, you can check the next available collection date as long as you know the mandate reference (which is available through the QuickFile API).

If you do specify a bank holiday or weekend day however, GoCardless will automatically roll this forward to the next working day. So if for example you requested a collection on Good Friday, it would roll forward to the following Tuesday automatically (because of Easter Monday).

Hope that helps!

This is the error response we get back when it fails, because a date is selected that’s not available like a bank holiday

   'Client_NewDirectDebitCollection' => [
      'Header' => [
         'MessageType' => 'Response',
         'SubmissionNumber' => '1431706538'
      'Body' => [
         'Error' => 'The payment request was not successful.',
         'GoCardlessBillID' => null

@Paul_Cheetham - What date are you using as the request date?

Hi Matt,

As there is no holiday in future so I can’t test it with holiday but our direct debit had failed earlier on 25th Dec 2020. So I have used 24th Jan 2021 as collection date and available date is 26th Jan 2021 just for testing and got this error.

Usually a payment will fail if it’s requested too early. So if for example, it was requested on 23rd December, 25th is likely to be too soon.

If it’s a new direct debit, even 21st December may be too soon.

“We had requested on Sunday 20th Dec 2020 for collection date 25th Dec 2020 but it failed because 25th was holiday.”

Was it a new direct debit, or is it one that has been in place for a while?

As mentioned above, the error comes back because it’s too soon. GoCardless will automatically roll the date forward if it falls on a bank holiday, so this shouldn’t cause an issue.

“It was New direct debit which send nothing for Bill Id”

For more info -

we are using NewDirectDebitCollection method for this and setting $collection_date

“Body”: {
“CollectionType”: {
“AllocateToInvoice”: {
“ClientID”: “’.$quickfile_client_id.’”,
“InvoiceID”: “’.$invoice_id.’”,
“ChargeAtDate”: “’.$collection_date.’”

If it’s a new direct debit, that’s likely why it failed. A new direct debit can take a bit longer to set up so the next charge date is a bit further away than usual.

GoCardless suggests it can take around 6 working days for the full process (that is, setting up a new mandate and requesting the payment).

With requesting in on the 20th December, that leaves 4 working days that week, and with Monday being a bank holiday (for Boxing Day), I would expect the earliest charge date to be around 29th or 30th December. Any date prior to this would fail.

Likewise with this, if the earliest available date is the 26th January, requesting a payment for the 24th will cause an error as it’s prior to the earliest available date.

I will however feed this back to our team to see if there’s a way we can make this clearer.

This topic was automatically closed after 7 days. New replies are no longer allowed.