#withapain

1 messages ยท Page 1 of 1 (latest)

karmic solarBOT
jovial wagon
#

Hi! Let me help you with this.

#

What do you mean by "customer account" and "account" exactly?

topaz valve
#

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
jovial wagon
#

I think there's a confusion here. Why would you create a whole Stripe account for just validating a card?

topaz valve
#

ah, yeah

#

Customer object, sorry

#

I meant I do not want to create customer object before verifying the CC info ๐Ÿ™‚

jovial wagon
#

Is this how you verify cards right now?

topaz valve
#

yeah

jovial wagon
#

Is it working without providing the Customer?

topaz valve
#

probably our BE endpoint always creates a customer before returning a key

jovial wagon
#

You definitely know more about your backend than me ๐Ÿ˜…

topaz valve
#

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?
jovial wagon
#

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

topaz valve
#

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

jovial wagon
#

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.

topaz valve
#

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
jovial wagon
karmic solarBOT
topaz valve
#

oh!

#

That is nice

#

How can I later connect this setupIntent to the user? Will it automatically attach CC info to his profile?

prisma wing
topaz valve
#

I have it in reversed actually

#

I have a setupIntent, but am just creating a customer, which I want to connect to this setupIntent

prisma wing
#

If it's not confirmed yet.

prisma wing
topaz valve
#

so wait

#

I can update setupIntent, right?

#

you gave me two alternatives?

prisma wing
#

yes you can update the SetupIntent if it's not confirmed yet.

topaz valve
#

ah, so actually in my flow it is not possible

#

So I would need to do what you have suggested