1

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?

jesseCampeez
  • 97
  • 10
  • 2
    You'll want to [convert the timestamp to a datetime](https://stackoverflow.com/questions/3682748/converting-unix-timestamp-string-to-readable-date) first, and then provide that converted value for the metadata. – taintedzodiac Mar 27 '19 at 15:50
  • that did it thank you for your time – jesseCampeez Mar 28 '19 at 11:22

0 Answers0