Calculate Donate / Pay Button Value from Form

Using WIX Studio.
Can I calculate the Donate / Pay Button value based on form inputs?

With a form that allows up to ten entries (using 2 initially to troubleshoot)…

  1. Sale Order #, Exhibitor Name, Amount
  2. Sale Order #, Exhibitor Name, Amount
    etc.

Total all amount fields

export function AmountChanged(event) {
     let a1 = Number($w('#Amount1').value);
     let a2 = Number($w('#Amount2').value);
     let aTotal = (a1 + a2);
     $w('#AmountTotal').value = String(aTotal);
}

Initiating AmountChanged function with each amount change event.

I want to pass aTotal to a Pay or Donate button. I’ve tried every Help topic, approach etc. that looks like it might work but need help in determining IF this can happen and the best approach to achieve. I’m not an expert coder, but can usually figure things out with some direction.

Any help is greatly appreciated!

Are you getting an error message when trying this?

No. No error. I just can’t figure out how to “pass” the total amount to the pay button.

Are you using Wix Pay?

If so you can manually create payments with: wix-pay-frontend