#_nerder

1 messages · Page 1 of 1 (latest)

cinder heartBOT
weak ledge
#

Can you share more details? Where exactly are you running into trouble?

remote island
#

Hey! let me explain

#

please consider that we are using connect so in our app we are creating customers on behalf of our connected accounts (which are gyms)

#

when the user joins the gym, and the gym has an active Stripe account connected with us then we immediately create it as a customer only in case this customer email is not already present in the Stripe account. Then we listen for customer.created event and we replicate this into our DB so that we can access the customer.id later on when the user attempts to purchase a product.

#

everything works smoothly, but right now we are facing an issue with this new academy which was using a stripe integration from their website before of using our app, now that they are connected to our platform we are attempting to create customers on their behalf, but some of them are created already creating an inconsistent situation with our flow

#

(the customer is created already, so I don't create it again, so the webhook is not firing, so the customer is not present in our DB at the moment of purchase, so the integration broke)

cinder heartBOT
remote island
#

My questions are:

  1. Should I have a script that is fetching and creating all existing customers in bulk when the account connects to our platform?
  2. Should I avoid creating the customer beforehand and just create a new one on the fly when making the first purchase?
lyric cairn
#

Hi 👋

I'm trying to catch up

#

and you wrote A LOT

remote island
#

sorry, I tried to make it clear 🙏

lyric cairn
#

So a customer signs up directly with you? Not with the connected accounts?

remote island
#

no sign up with the connected account, we just handle the subscription creation for them

lyric cairn
#

Okay so what is the issue you are facing that would require you to create customers in bulk?

remote island
#

basically this scenario is for accounts that was previously using Stripe and then connect:

the customer is created already ➡️ so I don't create it again ➡️ so the webhook is not firing ➡️ so the customer is not present in our DB at the moment of purchase ➡️ so the integration broke

#

basically until now I was assuming that the customer was never there when attempting to create it, so I could always create it in advance.

lyric cairn
#

Okay so you need the customer to exist in your DB

remote island
#

yes

#

probably my best guess here is this:

  • I should expand my "create subscription" method to also handle customer creation in case none is present
#

I create the customer the first time their purchase anything and then I'll always have it for any subsequent payment

lyric cairn
#

So I think option 2 would make the most sense. Since some Connected Account may have customers from a while ago that never re-appear