Go Cardless Problems

Hello All New To Invoice Ninja but I’m getting the following error on a red banner on the customer invoice page when I click to pay through GoCardless:

Self Hosted Invoice Ninja shows:
Gocardlessv2\redirect: Invalid ‘Authorization’ header

Cloud Hosted Invoice Ninja Trial Shows:
Gocardlessv2\redirect: Undefined index:

I’ve hunted high and low and I can’t find anything related to this online other than refs to 2016 when the API changed. (definitely running the newest I/N release).

I’ve tried both a free trial of the cloud product and the self-hosted solution. GoCardless Sandbox accounts work and allow test payments through with either hosting solution.

Other payment gateways work, i.e stripe

I’ve contacted GoCardless as I thought it could be to do with their end but they are quite sure it isn’t.

Does anybody have any knowledge about this error that might help?

Really loving Invoice Ninja, just a shame we can’t get our direct debit solution working!

Very Much Appreciate any assistance with this problem.

I’m not sure, the “Invalid ‘Authorization’ header” error implies there may be a problem with your credentials.

Are you using your live/production token?

Hello Hillel,

Thanks for your reply.

Unfortunately, I’ve systematically gone through everything multiple times to rule this out.

My two Invoice Ninja Accounts (cloud/self-hosted)
and 2 Gocardless accounts (I set a second up to rule out an account anomaly)

I get the results consistently:

GoCardless Sandbox account > allows cloud/self-hosted to process fake payments perfectly
Either GoCardless Account + Either Account Ninja (cloud/self-hosted ) the errors I mentioned before.

I’ve been through the API + Webhook setup process about 8 times with new keys from GoCardless Dashboard each time (While disabling old keys) Logged each action so I know that I’m using current keys (correct combinations)

I’ve triple checked the webhook URL (and when I swap between account ninja cloud/self-hosted I update the webhook URL)

I don’t enter any information in the “client certificate” section of the GoCardless Webhook setup page. I can’t see any reference in the KB mentioning that I need to do this, am I correct to leave this section blank?

Many thanks!

Sorry, not sure… you may want to try debugging the response here:

https://github.com/invoiceninja/invoiceninja/blob/master/app/Ninja/PaymentDrivers/BasePaymentDriver.php#L317

I don’t think this is related to the webhooks.

Thanks for Your Input!

Sorry to be a pain, but would it be possible to confirm that you can click through to a live go cardless account on one of your N/I accounts? I’ve checked everything I can find to no avail.

Issue Invoice > View as Customer > Click “Pay Now” select “Go Cardless” > (Mine bounces and says auth failure on both your hosted and self-hosted solution now)

Really appreciate it, thank you! :slight_smile:

We only have a test GoCardless account.

If you email us the raw response it’d help us debug the problem.

api_error: {#937 ▼
      +"message": "Invalid 'Authorization' header"
      +"errors": array:1 [▼
        0 => {#934 ▼
          +"reason": "invalid_authorization_header"
          +"message": "Invalid 'Authorization' header"
        }
      ]
      +"documentation_url": "https://developer.gocardless.com/api-reference#invalid_authorization_header"
      +"type": "invalid_api_usage"
      +"request_id": "########-####-####-####-############"
      +"code": 401
    }
    #message: "Invalid 'Authorization' header"
    #code: 401
    #file: "###############################/gocardless/gocardless-pro/lib/Core/ApiClient.php"

Redacted Request_id just in case.

I’m not sure, if you want to email your live token to contact@invoiceninja.com I can try to reproduce the problem.

 "headers" => array:7 [▼
        "GoCardless-Version" => "2015-07-06"
        "Accept" => "application/json"
        "Content-Type" => "application/json"
        "Authorization" => "Bearer "
        "GoCardless-Client-Library" => "gocardless-pro-php"
        "GoCardless-Client-Version" => "1.4.0"
        "User-Agent" => "gocardless-pro-php/1.4.0 schema-version/2015-07-06 GuzzleHttp/6.2.1 php/7.0.26 curl/7.47.0 curl/x86_64-pc-linux-gnu"

It seems the Auth isn’t filling out?

I think I see the problem, please try applying this patch to your self host install to see if it helps.

https://github.com/invoiceninja/invoiceninja/commit/781073c7a180b03d6f37b6631f8eda02b5a8f013

Great! It works perfectly so far! (just need to run an actual payment though)

Great to hear, thanks for letting us know!

Hi, I’m having the same issue with my self host account and get the following error when trying to pay an invoice for real.

Gocardlessv2\redirect: Invalid ‘Authorization’ header
Download PDF

I used Softaculous Auto Install, so not that sure how to install the patch but happy to try with some instructions. I’m currently running version 3.9.2 is the patch likely to be applied to future updates as I’m not in a hurry to get it working so happy to wait if it will be applied anyway.

Many thanks

This fix will be included with our next release (v4.0)

Brilliant thanks I’ll wait for the update.

Hello,

I need help with GoCardLess integration, my Invoice Ninja is v4.3.1, running on docker, ssl enabled, but I can’t set it up correctly…

Where can I find Access token and Webhook secret ?

Thank you

You’ll need to follow up with GoCardless for help, I think the values are shown in their portal.

Yes I did but I think I might have done a mistake because I always get “Gocardlessv2\redirect: The access token you’ve used is not a valid live API access token” error.

Can I have more informations about what I have done wrong ?

Or maybe someone already have set it up correctly ?

Sorry, I don’t have any more info.