#aeu1999 - checkout
1 messages · Page 1 of 1 (latest)
Hi there! Pasting all your message in this thread:
In the checkout_session.php which ‘if’ statements can we add.
In the tutorials, there is a js function present but doesnt show how to use it, what php folder to communicate it with and what php method to use
if we can do the 'if' statment the way we want before redirecting to save the customer details on our database, then we can redirect to success page.
I'm not sure I understand the question. What are you trying to do exactly? Why do you need an "if"?
You want to save the information the user entered on your website in your own database?
After the order is paid we want to save the form info before being sent to the success page
So the user fills the form on your website, then clicks on the button to be redirected to a Checkout Session, and when the payment is successful you want to save the form information in your database?
Yes
Well I would save the information directly when they click on the button, either in your own database or on the metadata field of the Checkout Session. Then listen to checkout.session.completed event to be notified when the payment is successful, and when that happens add a flag in your database to say that the payment is completed.
Ok ill check this, thanks
The method you discussed, is it for a custom checkout or a prebuilt checkout, what php and js codes are required for this. Is a tutorial/demonstration available for this.
You want the payment form to be embed on your website, correct? Then you need to use PaymentIntent + PaymentElement, that's called custom payment flow in our doc here https://stripe.com/docs/payments/accept-a-payment?platform=web&ui=elements
However we don't cover how the customer can dynamically set the amount.
The simplest option would be: first ask the user to pick an amount on the frontend, send that amount to the backend, and create the PaymentIntent with the correct amount, and finally display the Payment Element on the frontend.
Please ignore my last message, it was for a different user, sorry!
is it for a custom checkout or a prebuilt checkout,
Both could work. It depends on what you need:
- Checkout Session: Stripe hosted page
- Custom checkout: the payment form is directly embed on your website
Is a tutorial/demonstration available for this.
Yes you can learn more about both options here https://stripe.com/docs/payments/accept-a-payment
Hi, i couldnt find details on the website you sent, relating to the method you described.
Isnt it possibe, using the prebuilt checkout, to save our form data to our database before the user is directed to the success page. Then we will manually direct the user to the success page.
Hello, soma had to step out but I can help out here. You can't get info directly from the Checkout form but you can get that data in your server-side code via the API or a webhook event
Basically, the flow is that your user is directed to Checkout, they make the payment, when the payment succeeds, they are automatically redirected to the success_url that you provided
So you can look up info and redirect them when they go to your success_url
Does that answer your question or were you asking about something else?
Can we intervene when the payment succeeds, so before directing to the success page automatically, we first save our form data to our database, then we redirect it to the success page
Hi 👋 jumping in as my teammate needs to step away. I don't think you'd be able to do that. Checkout Sessions create a hosted page for customers to complete the checkout process, so once they're routed to that page they will have left your site.