#taisklein

1 messages ยท Page 1 of 1 (latest)

kindred oreBOT
young mural
#

Hi there!

copper warren
#

Yes!!

#

I have the customer ID

young mural
#

So why don't you update the customer just before creating the Checkout Session?

copper warren
#

Do I need to use the webhooks events to do that? I mean when customer created -> make the post to update the customer and assume that this is always after the checkout session is created? I use the stripe checkout with firebase extension

young mural
#

You could, but you don't need to use webhook event. In your existing code, just before creating the Checkout Session, write some code to update the customer.

copper warren
#

Nice!! But here I dont have the customer ID

#

then I would need to get it

#

but do you mean here, right?

#

but I dont know if the customer is already created here

young mural
#

I though you already had a customer ID. If needed you could create one, and then pass it when you create the Checkout Session.

#

But taking a step back, can you clarify why exactly you need to update the customer before the payment is finished?

copper warren
#

Nice!! Yes, I need to pass some metadata on the customer (user name and user tax ID) to integrate with e-notas

#

and when the customer is charged, the charge object must be send with this metadata

young mural
#

Got it! Then yes:

  • First create the customer
  • Then create the Checkout Session with that customer
  • And then listen to the checkout.session.completed event to update the charge object
copper warren
#

Thank you!! But I think I wont need to update the charge object, because if I update the customer object, when the customer is charged the charge object will already have the medatada sent, right?

young mural
#

If your customer has some metadata, then that metadata won't be added to the Checkout Session or PaymentIntent or Charge. It's up to you to update these objects with metadata if needed.

copper warren
#

Ok, thank you!!

young mural
#

Happy to help ๐Ÿ™‚

gilded mica
#

๐Ÿ‘‹ taking over for my colleague. Let me know if there's any follow-up Qs I can answer!