Complex Calculation with Custom Code

I have a complex financial calculation dealing with financial payments… is there a way to:

a) create a custom function that takes input from a form and does the calculation
b) takes the output of that function and sets it to an input value?


Yes. You can pass the data through an API to wherever you’re hosting your custom algorithm and then you can pass it back to Bubble via the API as well.

We’ve used amazon Lambda to host our algorithms. It’s quick and easy to set-up, highly performant, and it happens to be super cheap too.


To add to Scott’s excellent post …

A general rule to help decide whether to put the calculation in javascript on the page vs through an API.

When all the data for the calculation is derived from the page or is from available to the user from your app.

When you don’t want to share the calculation method with the user.
When the calculation uses additional data from your app that you don’t want to share with the user.
When the calculation uses other APIs, and your app isn’t retrieving them.
When the calculation needs to be initiated by the server (API workflow).


Thank you so much… is there a tutorial on how to put custom javascript on a page???

So far the software has a steep learning curve for me, but javascript is easy… getting it on the page will be the challeng

@akerezy connecting javascript with Bubble is not easy, but has been done.

Including javascript

  • Settings > SEO/Metatags > Script in header/body
  • Page HTML Header
  • HTML element
  • Some plugins like Toolbox (self promotion hehe)

Executing javascript / passing values to javascript

  • Making a HTML element visible
  • Plugin actions, like Toolbox “Run javascript” or “Expression”

Passing data from javascript to the Bubble page:

  • Funky workarounds using an edit control’s value
  • Some plugins elements, like Toolbox “Javascript to Bubble” or “Expression”
  • You can also write your own plugin to do custom integration.

Toolbox plugin has a (long) discussion topic, and links to some example apps.

There are other plugins that do similar things to Toolbox.

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