#harshil-ahir_code
1 messages · Page 1 of 1 (latest)
👋 Welcome to your new thread!
⏲️ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
🔗 This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1339840202549624902
📝 Have more to share? Add more details, code, screenshots, videos, etc. below.
Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- harshil-ahir_code, 21 hours ago, 20 messages
Hi! It looks like the payment intent (pi_3QsHwOG1F3i02paL18UXYH4G) for this checkout session was successful: https://dashboard.stripe.com/test/logs/req_lpvk9P3WU0k6W7
Where are you seeing failed payment?
if payment is successfull i am redirecting my flow to dashboard but it shows something went wrong
and then it will came to same payment page and it will make my session client secret key as null
same payment page
Same payment page as in the the checkout page?
yes
also i am seesing the logs of my session and it shows my session status as open
also "payment_status": "unpaid",
Can you give me an example session ID for those with "payment_status": "unpaid"
its the same session id which i gave you before
cs_test_b1LtUt656NVDmTaH8s0nian3c3HiBmkXNq9br7ugTVIJWeK4FgB5byY7yF
in these session logs i can easly see my payment status as unpaid and status as open
For the event that says "payment_status": "unpaid", are you referring to the checkout.session.completed event (https://dashboard.stripe.com/test/events/evt_1QsHyrG1F3i02paLGtw7nopM) ? If yes, it says unpaid because you're using an asynchronous payment method, so the payment is not immediate. If you look at the checkout.session.async_payment_succeeded event (https://dashboard.stripe.com/test/events/evt_1QsHz2G1F3i02paL6AuWpOE9), you'll see payment_status: "paid".
actually my api calling is work place when payment is placed which will give me my session id from frontend and then i will confirm the payment is done or not with the help of status ,do i need to change anything for these
also as you said bank payment are not immediate so for these did i need to implement webhook for it ??because i haven't applied it yet also if yes can you please guide me how can i do it
actually my api calling is work place when payment is placed which will give me my session id from frontend and then i will confirm the payment is done or not with the help of status ,do i need to change anything for these
Sorry to confirm are you saying that you are getting the checkout session ID from the URL after the customer is redirected?
also as you said bank payment are not immediate so for these did i need to implement webhook for it ??because i haven't applied it yet also if yes can you please guide me how can i do it
- Yes, you should implement a webhook for them (https://docs.stripe.com/checkout/fulfillment#create-payment-event-handler).
- This is how you can setup your webhook: https://docs.stripe.com/webhooks
i am getting session id from url
the flow is like i am sending the return url to a frontend page with my session id
.setReturnUrl(frontendDomainURL + ApplicationURLConstants.PAYMENT_REDIRECT+"?session_id={CHECKOUT_SESSION_ID}")
and at that page they are getting the session id and they are sending that session id to my api and in my api i am checking the payment_status and status
also my card payment are working propely with these current structure do i need to implement webhook for them also
You shouldn't be relying on triggering fulfilment only from your Checkout landing page, because your customers aren’t guaranteed to visit that page. (https://docs.stripe.com/checkout/fulfillment#:~:text=Webhooks are required)
You should be using webhooks for fulfillment.
okay so i need to use webhook for every payment method that what you are trying to say
Yes
Okay
I have one more doubt like what will i get from webhook my session id from which i can know that
also if payment is done than what we have to show to customer because there was a loading in that page which is going to call and the bank payments can take time
I have one more doubt like what will i get from webhook my session id from which i can know that
Sorry I am a little confused. Are you asking what can you know from the webhook events?
lets suppose i have created some apis as public access and also created 2 events success and failure of my every payment for now i have only my session id and lets suppose my payment has done and from stripe the events occurs and came to my api with the event id how can i know for which payment id it was coming
I am assuming you are asking how do you determine which payment is the event for when the event is sent to your webhook endpoint (correct if I am wrong). The event includes both the checkout session ID and the payment intent ID. The examples below, both have the session ID (cs_) and the payment intent ID (pi_):
- checkout.session.completed - evt_1QsHyrG1F3i02paLGtw7nopM
- checkout.session.async_payment_succeeded - evt_1QsHz2G1F3i02paL6AuWpOE9
Okay i have one more doubt
how can i get these two from my session id because from now i have only have session id with me
how can i get checkout.session
Sorry what are "these two"? The Events I listed above?
session events but when i am viewing my session logs there these two are not present
wait are you trying to say from these event i will get my session and payment intent ID
You will need to listen for these events via your webhook endpoint: https://docs.stripe.com/webhooks
These are all the available events you can listen for.
??
wait are you trying to say from these event i will get my session and payment intent ID
Yes
So instead of relying on the session ID after your customer gets redirected, listen for these events which give you your cs_ objectID as well as the pi_ object ID.
okay please can you confirm the flow once
first the event trigger success or failure trigger from the stripe depend on the payment status
lets suppose payment was success so it will came to the api which i have mention in payment success event and that api will give me event id in the request and from that event ID i will get my session ID which i have already stored in my database and then i will make my payment status as success
same goes for failure
Correct me if i am wrong
I am not sure what do you mean by "came to the API".
Take a look at the payment that was created from the checkout session: https://dashboard.stripe.com/test/payments/pi_3QsHwOG1F3i02paL18UXYH4G . At the bottom there is the Events and logs section. Here you can see all the relevant events that is typically created. Some example: payment_intent.created, checkout.session.completed, payment_intent.succeeded, etc.
When you set up and register a webhook endpoint with Stripe, depending on what events you choose to listen to, we will send them to your webhook.
For example, as recommended by this document (https://docs.stripe.com/checkout/fulfillment), you're listening to checkout.session.completed. We will send this to the webhook endpoint. From here you can retrieve the relevant information such as the session ID and the payment intent ID. You can also see the status of the payment from this event. You can then store these information in your database and proceed with your fulfillment.
Please dont close these chat i will be here after lunch in 45 mins approx
Okay i am getting what you are trying to say