#alle00
1 messages · Page 1 of 1 (latest)
hi! that's not possible at the moment no. The wokrarounds would be
- create a Customer first with the metadata you want and pass that to
customerwhen creating the CheckoutSession - when handling the
checkout.session.completedevent, call the Update Customer API on thecustomerit created - add metadata somewhere else like directly on the CheckoutSession
Thank you, I think I'll go with number 2, I have a follow-up question, assuming I have a lot of customers that do not have this set (we have been going on for a year and now I realize I need that ID for some internal linking) and I'm writing a script to set this field for everyone, all of them have their yearly subscriptions which have userId set in the subscription meta data, would the best approach be to retrieve it from that meta data, get the customer associated with the subscription and then add the meta data to that customer? Also could there be duplicates or does Stripe handle the cases where a single person (with the same email) buys multiple subscriptions and links them all to 1 customer
updating the customers in bulk as you describe could work yes and seems normal/sensible. The alternative is to change the 'read side' of your app so you first check if the Customer has your metadata field, and if they don't then you retrieve their Subscriptions and check if any of them have it.
Also could there be duplicates or does Stripe handle the cases where a single person (with the same email) buys multiple subscriptions and links them all to 1 customer
we don't do any deduplication like that(generally if you want to avoid this we recommend authenticating the customer on your site before redirecting to Checkout, and picking an existing cus_xxxx to pass tocustomerif one exists for that user/email)
alright, thank you for the information! really appreciated!