What is the recommended way to submit 2 forms – one customer info form and 1 payment form

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.


  1. Use AJAX to submit both forms
  2. 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?)
  3. Use AJAX but submit over HTTPS
  4. Put the payment form on a separate page (this hurts the checkout flow though…)
  5. Put both forms on the same page but submit the payment form first. If payment is successful, use redirect pages and $_SESSION or $_COOKIE variables 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.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s