Advertisement

Your Ad could be here. I want to connect my readers to relavant ads. If you have a product targeted at developers, let's talk. [email protected]

Here's my thought on Retrieve an upcoming invoice | Stripe API Reference


You can find your customers next billing date through the stripe api by using Invoice. and passing in customer, customer_details, subscription, or schedule.


import stripe
stripe.api_key = "sk_test_51ODvHtB26msLKqCAPBAo1qkBBuIfT5tQBX6YFWCLMsPixIExxITCRVa9tNCIqkdQS8olhR79NYXsFWBPKsM3LbGO00zEcNQfNI"
invoice = stripe.Invoice.upcoming(customer="cus_NeZwdNtLEOXuvB")

Within the invoice, you can find the next_payment_attempt as a epoch.


date = datetime.fromtimestamp(invoice.next_payment_attempt)
amount = invoice.amount_due
currency = invoice.currency

This post was a thought by Waylon Walker see all my thoughts at https://waylonwalker.com/thoughts