#ubi

1 messages · Page 1 of 1 (latest)

cursive muskBOT
celest berry
#

Hi there, No. a paymentIntent doesn't expire

peak veldt
#

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

celest berry
#

Oh, so you get the answer from chat GPT?

peak veldt
#

Told me that Payment Intent expires, after I tried to Google for it ... sooooo, yeah, dont trust bots

celest berry
peak veldt
#

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 sadCAKE 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

celest berry
#

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.

peak veldt
#

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

celest berry
#

One PaymentIntent is for one purchase, you can't use the PaymentIntent to accept payments more than once.

peak veldt
#

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

celest berry
peak veldt
#

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 thinkchuck

#

Or I can make the association in my side as well and do the Idempotent stuff 🤷‍♂️

celest berry
#

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

peak veldt
#

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

  1. Upon Customer Signed Up
  2. Create a Stripe Customer
  3. 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 sad

celest berry
#

Can you tell me the problem you face with Payment Link?