0

Trying to use the gocardless-nodejs api module on an Angular 12 app, and followed the instructions.

Importing the module as follows:

const gocardless = require('gocardless-nodejs');
const constants = require("gocardless-nodejs/constants");

Then trying to create the client:

const client = gocardless(
    [gcAccessToken],
    // Change this to constants.Environments.Live when you're ready to go live
    constants.Environments.Sandbox
);

but keeps showing this error: ERROR TypeError: gocardless is not a function

tigerdi
  • 612
  • 7
  • 13
  • I get the impression that library is not meant to be used in a browser based application, only in a node based application. – R. Richards Jan 26 '22 at 14:43
  • That could be it, but what exactly is stopping me from accessing that function? After all, `console.log` will reveal the results of `constants.Environments.Sandbox` – tigerdi Jan 26 '22 at 14:52
  • If it were a library that was meant for browser based development, then adding the typings for that library would likely eliminate that error. Typescript cannot resolve the function without the typings installed. – R. Richards Jan 26 '22 at 15:01
  • I have added it to the node express app instead, and is working there. Many thanks – tigerdi Jan 26 '22 at 15:36
  • 1
    They are developing client api for gocardless. You can checkout in doc. But it's not production ready yet. So only option remaining use inside server side node.js – Developer Jan 26 '22 at 15:38

0 Answers0