#withapain
1 messages ยท Page 1 of 1 (latest)
Hi! Let me help you with this.
What do you mean by "customer account" and "account" exactly?
both mean Stripe accounts.
My flow goes like this: When customer enters CC info on Frontend, I create Stripe account and then run confirmCardPayment to add this data
The problem is, that if CC info is wrong, I still end up having a spammy stripe account created
So, I want to change my flow to the following:
- Customer enters CC info
- I verify if it is corect (not sure how)
- If so, I create his stripe account and subs
- and, I run
confirmCardPayment
I think there's a confusion here. Why would you create a whole Stripe account for just validating a card?
Maybe you mean Customer object? https://stripe.com/docs/api/customers/create
ah, yeah
Customer object, sorry
I meant I do not want to create customer object before verifying the CC info ๐
customer field is optional for SetupIntents, so you might be able to attach it after the setup is completed: https://stripe.com/docs/api/setup_intents/create#create_setup_intent-customer
Is this how you verify cards right now?
yeah
Is it working without providing the Customer?
probably our BE endpoint always creates a customer before returning a key
You definitely know more about your backend than me ๐
hmm, so can I do something like this:
- User enters CC info
- We call /verify on our BE, which creates on Stripe SetupIntent object, but without customer and everything (it is optional). It will return client_secret
- We call await stripe.confirmCardPayment(client_secret, ...) to verify if CC is valid
- If valid, FE will call BE /create_stripe_customer with this secret, which will create Stripe Customer object + subscriptions and attach this setup_intent to those?
I would recommend against the last step, as the customer might close the page before the request is completed. Please use webhooks instead: https://stripe.com/docs/webhooks
oh
hmm, but setupIntentSucceeded in it's current form will not have any customer metadata
For instance, currently our BE gets information like:
- Email, id of customer (cause he is logged in)
- which plan did he choose (we have 2 different plans, which create different subs)
OK, I guess I would need to save this info in /verify then
with SetupIntent ID attached
Also, you will need to create a SetupIntent prior asking the customer for their card info.
That's when you can also save the other info.
y, this will be in /verify I guess?
So the flow of this endpoint is:
- Create SetupIntent Object
- Save customer metadata to my DB
- return client_secret
and flow of a webhook would be:
- Create account/subs based on the id of SetupIntentSucceeded
Yes. You can also use SetupIntent metadata field to save the info, if you don't want to create your DB record just yet: https://stripe.com/docs/api/setup_intents/create#create_setup_intent-metadata
oh!
That is nice
How can I later connect this setupIntent to the user? Will it automatically attach CC info to his profile?
Hey! Taking over for my colleague.
You can pass the customerId when creating the SetupIntent:
https://stripe.com/docs/api/setup_intents/create#create_setup_intent-customer
I have it in reversed actually
I have a setupIntent, but am just creating a customer, which I want to connect to this setupIntent
You can update the SetupIntent:
https://stripe.com/docs/api/setup_intents/update#update_setup_intent-customer
If it's not confirmed yet.
You can start by creating an empty Stripe Customer Object, create a SetupIntent with that customer and then update the customer data.
yes you can update the SetupIntent if it's not confirmed yet.