Following a company spinoff, we need to delete a list of ~1200 old customers from our stripe account. I'm currently trying to do it using python via their API. The code to delete a customer via the API looks like this:
import stripe
stripe.api_key = "test-api-key"
cu = stripe.Customer.retrieve("customer_id")
cu.delete()
I have a csv of all 1200 customers I'd like to delete from my stripe account, but the API won't read them as a list if I paste them into the customer_id
field. Is there a way to run this bulk delete, or do I have to remove all of my customers one by one?
You could just perform this with a list comprehension:
import stripe
stripe.api_key = "test-api-key"
list_of_customers = ['customer_1','customer_2','customer_3']
[stripe.Customer.retrieve(i).delete() for i in list_of_customers]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.