Wrong result when charging user using Braintreepayments Plugin

I have 2 input fields that accept values as integers. They are not allowed to be 0 or empty. The default value is 1 for each one. When entering the email and clicking pay (this is the way I charge the user), in the workflow I set the first input’s value * 16 ($) + second input value * 8 ($). The result should be 1 * 16 + 1* 8 = 24, but it results in being 136. Am I missing something? I tried debugging it using the debugger, but the result is still 136.

Yes, our expression composer doesn’t respect mathematical priorities yet. So you should write it in a way that works from left to right. See what I mean?

Could you give me an example, please?

right now 1 * 16 + 1* 8 is interpreted by Bubble as ((1 * 16) + 1)* 8 = 136. So you should rewrite your expression to avoid that.

1 Like

@emmanuel I ran in the same issue. Do you plan on supporting that soon, or even better, support expressions with parenthesis ? The way bubble work on this is really not standard at all, it is very confusing and error-prone.

We can find workarrounds for now, and this is good, but support this would be great :slight_smile:

@florent.bocquelet

Yes! Support for parenthesis would make my day/week/year.