Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

stuter12's avatar

Form handling with Stripe

I have a form that is collecting a bunch of information. The intention is to have them pay via stripe at the very end, and if the charge goes through, post the other info to the database. My thought was to get rid of my submit button and just use the stripe 'pay now' to control the whole thing, and after the successful stripe charge, redirect somewhere that saves the rest of the form. Then I read that you can't do a POST redirect, so my other thoughts were:

  1. Attempt to charge the card with logic in StripeController, and if successful store the information from the rest of the form in the database. It doesn't seem right to have the StripeController be responsible for saving unrelated form data to the database.

  2. Have my other controller that was originally saving the form data also do the stripe charge, and save the rest of the form upon success, but that doesn't seem right either bc now that controller is responsible for charging.

Does that make sense? I'm not sure the best way to deal with this.

0 likes
0 replies

Please or to participate in this conversation.