I am working with 2 existing pieces of code – an existing WordPress Q&A plugin and Braintree’s API. Both have forms. The Question form goes to my WP table. The Braintree API submits the BT form to their servers and returns a payment method nonce so that sensitive payment info never reaches my servers.
I want both forms to be on one page and for the user to use 1 submit button to “submit” both forms. Doing my own research, I’ve summarized the ideas/arguments that I’ve found below.
- Use AJAX to submit both forms
- Don’t use AJAX because it submits over HTTP (does this matter if I’m sending payment info to the Braintree server and not my own server?)
- Use AJAX but submit over HTTPS
- Put the payment form on a separate page (this hurts the checkout flow though…)
- Put both forms on the same page but submit the payment form first. If payment is successful, use redirect pages and
$_COOKIEvariables to kind of re-enter what the user typed in and submit the question form
I can’t figure out what to do because I am new to web dev. Could someone with hefty web development experience provide some advice?? I can provide more info as needed.