#harshil-ahir_code

1 messages · Page 1 of 1 (latest)

fringe kelpBOT
#

👋 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.

toxic raft
#

Where are you seeing failed payment?

pliant heron
#

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

toxic raft
#

same payment page
Same payment page as in the the checkout page?

pliant heron
#

yes

#

also i am seesing the logs of my session and it shows my session status as open

#

also "payment_status": "unpaid",

toxic raft
#

Can you give me an example session ID for those with "payment_status": "unpaid"

pliant heron
#

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

toxic raft
pliant heron
#

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

pliant heron
toxic raft
#

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?

pliant heron
#

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

pliant heron
toxic raft
#

You should be using webhooks for fulfillment.

pliant heron
#

okay so i need to use webhook for every payment method that what you are trying to say

toxic raft
#

Yes

pliant heron
#

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

toxic raft
#

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?

pliant heron
#

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

toxic raft
#

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
pliant heron
#

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

toxic raft
#

Sorry what are "these two"? The Events I listed above?

pliant heron
#

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

toxic raft
pliant heron
#

??

toxic raft
#

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.

pliant heron
#

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

toxic raft
#

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.

pliant heron
#

Please dont close these chat i will be here after lunch in 45 mins approx

pliant heron
#

Okay i am getting what you are trying to say