How to use the react-acceptjs NPM package in Retool?

I need to process payment with Authorize.net through a NPM package called react-acceptjs, I have read some posts asking similar questions but so far I haven't found any clear information about if it is possible to use NPM packages in Retool and how to do it.

Hi @Kaizen! Great question :slight_smile:

While many external libraries do work in Retool, it unfortunately isn't possible at the moment to import every npm package directly into Retool. As mentioned in our docs (here), you need to import a UMD build in order for it to work. The library you import also can't contain any require statements. That doc also covers exactly how you can import libraries though so it's definitely worth a look!

That being said, if you're open to doing a bit of extra work there is an interesting guide here on how you can develop and publish your own custom component for use within your Retool app. If you're interested in reading more about how to work with custom components in your app you can read these docs.

Also, Retool runs its Javascript in a sandboxed environment so you most likely won't have access to the parent window's methods.

Hope this helps a little, and please do let me know if you have any questions!

1 Like