#akshay-payment-element
1 messages · Page 1 of 1 (latest)
Hi there!
Hrmm this doesn't really sound possible.
Can you explain more about what you are trying to accomplish?
Then we can talk about the best way to do so
Its like once i get to know the payment is successful.. i would like to confirm order for that user by writing some functions to my database..
I want all this to happen bfore stripe redirects to me the success url
Right now it’s directly redirecting me to the success url without executing my functions which i have written that will connect to my db
Why do you need this code to run before the redirect?
It shuld execute only after the payment is successfull
And i wont be able to execute this in the success page
Well overall you want to use Webhooks for this
That is the point, as they are foolproof for a dropped session from the customer where the payment gets confirmed but code after that never runs.
But will i be able to send my cart data to the webhook?
There are various ways to do that, yes.
Most folks attach metadata to the PaymentIntent which would be an order ID
Then that metadata will come through your Webhook and you match it to the cart that is already in your database based on the checkout page
So in the metdata i can attach anything i require right
Yep exactly. You would set it here: https://stripe.com/docs/api/payment_intents/create#create_payment_intent-metadata
Ok let me check that
I had one more thing to ask.. is it possible to hide the query parameters which is there in the success redirect url??
No that's not possible.