#ubi
1 messages · Page 1 of 1 (latest)
Hi there, No. a paymentIntent doesn't expire
We recommend creating a PaymentIntent as soon as you know the amount, such as when the customer begins the checkout process
If the checkout process is interrupted and resumes later, attempt to reuse the same PaymentIntent instead of creating a new one. Each PaymentIntent has a unique ID that you can use to retrieve it if you need it again. In the data model of your application, you can store the ID of the PaymentIntent on the customer’s shopping cart or session to facilitate retrieval. The benefit of reusing the PaymentIntent is that the object helps track any failed payment attempts for a given cart or session.
Which that second paragraph is what I wanted to do originally, but
@celest berry you kidding me!!!!!!!! ChatGPT screwed me over!
NEVERDMIND! uffff I know what to do then hehe
Oh, so you get the answer from chat GPT?
Told me that Payment Intent expires, after I tried to Google for it ... sooooo, yeah, dont trust bots
For completeness, a Checkout session do expires (https://stripe.com/docs/api/checkout/sessions/object?lang=java#checkout_session_object-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.
ahhh, that is probably where it got confused, or I asked the wrong question!
Let me try to find it, if the Payment Intent ever expire, then I am good, I know how to do a reliable payment then uuuuuuuffff :saved:
@celest berry ^
ChatGPT 4 so
so confident that I believed it
I feel stupid now!
If you dont mind helping with some other question, still related to get this to work. Should I create a Customer ahead of time when the user Sign Up? Ideally I do not want to save any Card or Shipping information in my end (using elements for that), but I would like to associate the payments to the right customer. I am not sure yet how to do that, I got the elements part thou.
Stripe.PaymentIntent.create(%{
amount: 1000,
currency: "USD",
metadata: %{
"course_id" => "..."
},
setup_future_usage: "off_session",
payment_method_types: ["card"]
})
Kind of what I have thus far
It's flexible. You can associate a customer when creating a PaymentIntent, or even later when the PaymentIntent is succeeded, whichever works best for you.
Ideally, whichever one that avoids the distributed transaction and/or a processor having to run otherwise my system is in a weird state.
What would happen if I do it when I create the PaymentIntent if I can buy multiple courses?
Is there any ID that would avoid duplicates of a customer? Ideally I use the ID from my system
One PaymentIntent is for one purchase, you can't use the PaymentIntent to accept payments more than once.
Right, but I can create more than one PaymentIntent, no?
Like, one per course in my case
Or am I thinking it wrong? I can't tell
Yes you can. And I'd suggest you to use Idempotent Requests to avoid making duplicate charges or creating duplicate customers https://stripe.com/docs/api/idempotent_requests?lang=java#idempotent_requests
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Is there any field beside email that I could associate my Customer ID to Stripe Customer ID?
Should I use the metadata for that? The tricky situation is that I can not Retrieve Customer by the metadata
Unless I should use Search Customer instead to get the customer back 
Or I can make the association in my side as well and do the Idempotent stuff 🤷♂️
If you want to associate a custom data with stripe data, then use metadata.
I believe you have you own DB that store customers, you can also save stripe customer ID to your own DB record and use the ID to retrieve the customer object from Stripe
right right, I will do that, just trying to figure out how to avoid multiple workflows acting upon the Customer creation type of thing
I think I know what I am gonna be doing
- Upon Customer Signed Up
- Create a Stripe Customer
- Associate Stripe Customer to Customer
In the Course Purchase the Stripe Customer must exists otherwise, something wrong happened, or the Customer was too fast nagivating, one of those two
Thank you so much for the help, really appreciate, I wish the Stripe Links would do all the stuff we need the Subscriptions stuff didn't work for us 
Can you tell me the problem you face with Payment Link?