#iam2327_code
1 messages ¡ Page 1 of 1 (latest)
đ Welcome to your new thread!
â˛ď¸ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
âąď¸ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
đ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1366856675918872646
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
Hello
Based on the syntax you seem to be using python.. Can you share the exact code you're using to update the Customer object?
To be clear, modify shouldn't create a new customer object
Hi,
Yes I am using python.
I also checked and there were two customers with old and new email not sure why.
Code:
First verify if the customer exists in Stripe
try:
customer = stripe.Customer.retrieve(account.customer_id)
if not customer:
print(f"Warning: Customer {account.customer_id} not found in Stripe, skipping")
not_found_count += 1
continue
except stripe.error.InvalidRequestError:
print(f"Warning: Customer {account.customer_id} not found in Stripe, skipping")
not_found_count += 1
continue
Create new email format using a different format that Stripe will accept
Using a dot instead of plus for better compatibility
new_email = f"{organization.id}+{account.user.email}"
Update Stripe customer
stripe.Customer.modify(
account.customer_id,
email=new_email
)
It's possible both customers with the same email existed prior to your code changes.
Can you try creating a new customer object with diff email and updating that?