#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/1341708598384001104
๐ 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, 5 days ago, 46 messages
- harshil-ahir_code, 6 days ago, 20 messages
๐ happy to help
sorry I'm not I understood the issue
would you mind elaborating more?
NP its solved
Thanks for your help
No such checkout.session: {CHECKOUT_SESSION_ID}; code: resource_missing; request-id: req_jfX4HgFsWxAxsb
wait can you please check that these paymentIntent have seesionID or not
what's the PaymetnIntent ID?
sorry for my late reply
yes the PI in question was created from a Checkout Sesion
the session ID is not in the metadata of the PaymentIntent
so as a metadata does the paymentIntent have session_id as checkout session id
what you're storing is this
session_id: "{CHECKOUT_SESSION_ID}"
},```
the session ID of main payment
yes I know but you're storing that String
which is wrong
you can drop the payment_intent_data.metadata and when you want to retrieve the Checkout Session ID for a PaymentIntent you can use https://docs.stripe.com/api/checkout/sessions/list#list_checkout_sessions-payment_intent
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
okay
its listing all checkout sessions but how can i get the specific failed checkout session for payment failed event i am trying to get my sessionID
Are you sure you're passing the payment_intent parameter?
sorry i dont understand
i amhandling payment failure for which i need to get session Id which i am not getting
What is the code you're using to make the API request?
You have a pi_xxx ID right, and you want the cs_xxx ID of the session associated to the Payment Intent?
yes how can i do that i have try somethings
You'd use this API and pass the pi_xxx ID to the payment_intent param. It'll return one session in the list
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
SessionCreateParams.Builder paramsBuilder = SessionCreateParams.builder()
.setMode(SessionCreateParams.Mode.PAYMENT)
.setUiMode(SessionCreateParams.UiMode.EMBEDDED)
.setCustomer(stripeCustomerId)
.setReturnUrl(frontendDomainURL + ApplicationURLConstants.PAYMENT_REDIRECT+"?session_id={CHECKOUT_SESSION_ID}")
.putMetadata("customer_id", customerId)
.putMetadata("buildcard_id", id.toString())
.setPaymentIntentData(
SessionCreateParams.PaymentIntentData.builder()
.setSetupFutureUsage(SessionCreateParams.PaymentIntentData.SetupFutureUsage.OFF_SESSION)
.putMetadata("session_id",CHECKOUT_SESSION_ID)
.build()
);
these fails then i have try another thing
No, that's your code to create the session
SessionListParams params = SessionListParams.builder()
.setPaymentIntent('pi_xxx')
SessionCollection sessions = Session.list(params)
okay if i use these code did i need to attach sessionId anywhere in PaymentIntent
also one more dount these SessionCollection will only return one session id right as per name it wont give collections
also my requirement is after payment failed i want to get sessionId from paymentIntent which these also work in the above code which you have provide
also one more dount these SessionCollection will only return one session id right as per name it wont give collections
That endpoint will always return a list yes, but there'll only ever be one result if you pass thepayment_intentparam (as a Payment Intent can only belong to one session)
Should do. Did you try it?
okay got it
working on it need to get many MR approves by many people
Alright, let us know if that doesn't do what you need!