#harinth-form

1 messages · Page 1 of 1 (latest)

cosmic shuttle
#

Hi! Are you using Payment Elements? And can you clarify what you mean by "we need to save the form"?

prisma kayak
#

I meant is the details given by the user can be submitted only if payment is successful

#

Is that possible?

#

On clicking submit button, it will call paymentIntent and go through authentication in the middle and if payment became successful after all those, the user can submit his details to the server

cosmic shuttle
#

Got it! When you call stripe.confirmPayment(), if the payment is successful, then the user will be automatically redirected to the return_url. So you would need to save the form details either before calling stripe.confirmPayment(), or once the user lands on the return_url.

prisma kayak
#

But if the payment failed, the user will resubmit the details again right?

#

There are lot of things happening in the server once the form is submitted after payment, like creating invoice based on the details and send notification etc.

I wonder how can I do that with out waiting for webhook.

cosmic shuttle
#

I wonder how can I do that with out waiting for webhook.
That's exactly what I was going to suggest.

#

You could listen to the payment_intent.succeeded event on the backend to know when the payment succeeded.

#

And you could update the metadata field of the PaymentIntent with the information in your form.

prisma kayak
#

So I need to submit the details in the form as serialised?

#

to payment Intent metadata

#

There can be images to be uploaded

#

payment_intent.succeeded event is a webhook event right?

cosmic shuttle
#

In that case store that information in a database, and only "confirm" the information when you get the payment_intent.succeeded event.