Stripe form and database

Im trying to make this Payment form to work with Stripe. So far I successfully added a new Stripe customer and I also can add the member details to my DB. My problem is that I need only ONE form button to make this work.

So far my workflow is like this:

  1. Get the member details like name email etc and this I store in JS variables

  2. Then I show the Stripe payment form to accept CC payment

  3. I then want to verify if the payment went through and this returns a status=active back to me when charge.php is run.

  4. If success I then want to add the JS variables to my DB

                 <form action="charge.php" method="post" id="payment-form">
                    <div class="form-row">
                     <label for="card-element">
                      <!-- Credit or debit card -->
                      <div id="card-element">
                        <!-- A Stripe Element will be inserted here. -->
                       <div id="card-errors" role="alert"></div>
                    <button>Submit Payment</button>

How can I make the Submit Payment button to also add my content to my DB? How do I POST my data to the charge.php file?

I have another JOIN button that passes the info via ajax and that works like a charm…but I dont know how to integrate the two.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.