#CheckMate-elements-session
1 messages · Page 1 of 1 (latest)
Hi, can we connect over google meet so I can explain what I am doing. It hard to explain everything over here. I've tried previously but it didn't work out.
Unfortunately not!
we can connect over a call on discord then ?
I just want to share my screen and explain
I'm afraid not. Feel free to record a video and share if that helps explain the issue!
cool
If you go to https://stripe.com/docs/payments/quickstart and select the options web, react, node and download the app there in custom payment flow(as shown in image). And then run the application in the network tab in browser you can see that sessions API is called.
Ok, cool. So can you elaborate on what you mean by 'expiring'? That's not something Elements natively supports
In the sessions API there is https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-expires_at.
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
That's for Checkout, which is a different product
You are saying "That's not something Elements natively supports" But if you run the app and see the sessions api is being called by the elements. There is no stripe.sessions.create() function called in scope
curl 'https://api.stripe.com/v1/elements/sessions?key=pk_test_51KP0OALGEyT9T908Fv0PuwhRMQ2N9sWsrwZQS5hvTan6m6e73Bsv42DyTQwiw63jlluM1tvzeemOrXlE1AvmKY3D00R0yeN1my&type=payment_intent&locale=en-GB&client_secret=pi_3LfguVLGEyT9T9080JZ9Ltpx_secret_KcgAdFB0WfGtKsjLXr2weLXSJ&expand\[0\]=payment_method_preference.payment_intent.payment_method'
-H 'authority: api.stripe.com'
-H 'accept: application/json'
-H 'accept-language: en-GB,en-US;q=0.9,en;q=0.8'
-H 'cache-control: no-cache'
-H 'content-type: application/x-www-form-urlencoded'
-H 'origin: https://js.stripe.com'
-H 'pragma: no-cache'
-H 'referer: https://js.stripe.com/'
-H 'sec-ch-ua: " Not A;Brand";v="99", "Chromium";v="104", "Opera";v="90"'
-H 'sec-ch-ua-mobile: ?0'
-H 'sec-ch-ua-platform: "macOS"'
-H 'sec-fetch-dest: empty'
-H 'sec-fetch-mode: cors'
-H 'sec-fetch-site: same-site'
-H 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.5112.102 Safari/537.36 OPR/90.0.4480.54'
--compressed
You can't expire an Elements session. You'd need to implement that yourself
No wait. Can you elaborate private sessions API ?
I have pasted the above cURL that i have found in the network tab
It's an internal API that Stripe.js calls when you're using Elements
So what does it do. Does it means the elements expire after a while ? If yes then how much time ? does the payment_intent expire too
Can you please explain me more or provide any documentation ?
What is it you're trying to do?
I want to know if payment_intent has expiry
Generally, no
generally ???
It would depend on what the status value is. Some of them are time constrained (requires_action) and may transition to a different state after a certain period of time
I recommend reading: https://stripe.com/docs/payments/payment-intents/verifying-status
What I am concerned about is ... Suppose a payment_intent is created , I send to the client both publishable key (which stripe sdk has) and client_secret. Now I see that a sessions API is called on elements . Does that mean after a certain amount of time no one can do payment using the client secret and publishable key .
No, the Elements 'session' is completely detached from the PI/client_secret
The PI itself will also be in a state where it can be confirmed/paid up until its explicitly canceled
The Elements session is just retrieving data from your account, the PI provided so it knows which payment methods to offer, etc
So are the elements expired , can no one use the elements to make payment after some time? If yes , after how much time ?
It doesn't expire AFAIK
So you are saying that the PI doesn't expire and the Elements too don't expire. Then why is a sessions API being called can you please explain ?
As I explained, it's an internal API that Stripe.js uses to setup the Payment Element according to the account settings and parameters on the Payment Intent
The fact its named a 'session' does not indicate it expires
You're confusing Checkout Sessions, which do expire
Account settings ? Can you please explain what account settings and where I can change that ?
i.e. which payment methods are enabled on your account, so which should be shown in the Payment Element
Ohhh Okay.
So to conclude there is no expiry I can confirm payment_intent even after 1 year of creating payment_intent ?
Should be fine, yep
okay cool
Just curious to know. If someone simply spam stripe by creating unnecessary payment_intents then do you guys store it in your DB. Won't it take unnecessary space, if you don't have expiry ?
I don't know the technical details of how that works, but even if they were to 'expire' they'd still be retrievable (and therefore stored somewhere)
okay cool
https://stripe.com/docs/js/elements_object/fetch_updates what does this do can I get more examples on where I could use this ?
It updates the Payment Element instance to reflect changes on the underlying Payment Intent
A tinydemo to show how to update the Payment Element to reflect changes on the associated Payment Intent.
A collection of tinydemos with Stripe.
Thank you very much
https://stripe.com/docs/js/element/events/on_networkschange?type=cardElement. what does this do can I get more examples on where I could use this ?
Hi! I'm taking over this thread.