I have a stripe connected account that I would like to update the metadata fields for existing customers. When one of our customers wants to cancel we move them to a "Free" subscription. In the metadata, I want to show this customer as canceled, and the date this occurred. Using this I was able to filter the customers on the free plan and add canceled to the metadata.
canceled=stripe.Subscription.list(
plan='plan_Elm8GW7mwgDj5S',
stripe_account=stripe_keys['acct_num'],
)
for cancel in canceled.auto_paging_iter():
customer_id=cancel.customer
canceled_date=cancel.created
stripe.Customer.modify(
customer_id,
stripe_account=stripe_keys['acct_num'],
metadata={'Status': 'Canceled',
'Canceled On': canceled_date}
)
However, the canceled_date returns: Canceled On 1552908524
rather than a readable date.
Any ideas on how to convert the created on field?