#brettski - Subscriptions
1 messages · Page 1 of 1 (latest)
Thank you. I tried the docs, but it wasn't clear
Yep, it does. These are the values that get updated:
"previous_attributes": {
"current_period_end": 1633071600,
"current_period_start": 1630479600,
"latest_invoice": "in_1JUnQyLieeNbcBYspJ3blZ8B"
}
How did you find that?
I have a test account with several Subscriptions. I checked to see if customer.subscription.updated events were firing and they were.
that'll do it :p
For Subscription renewals/when a new period starts I mean.
So to be clear, the customer.subscription.updated event fires with those updates wont happen until after the invoice is paid or is it when the invoice is created for the subscription renewal?
The example I provided fired when the next Invoice for the Subscription was generated.
Can you give me more details about your specific concerns/use case?
I want to update my database with subscription details as they happen. So when someone cancels their subscription (I got this one). When the subscription successfully renews (is paid) so I can update the expiration date in my database
I guess I am asking about that last sentence, specifically.
Gotcha. I recommend listening for invoice.paid to know when people pay for a Subscription renewal.
But then I need to figure out which subscription it is for. I was really hoping I could listen around the subscription itself.
The Invoice has a subscription property that tells you which Subscription it's for: https://stripe.com/docs/api/invoices/object#invoice_object-subscription
Okay, so it seems I need to consume two new events to handle subscription updates. customer.subscription.updated for canceled, and invoice.paid for renewals. Which means that one will be busy as we sell items too through checkout
Well checkout doesn't use invoices for line item purchases, it uses payment intents, correct?
Checkout doesn't generate Invoices. It either uses Payment Intents (for one-off payments) or Subscriptions.
right. good. Thank you for putting up with me as I get my head wrapped around this world again. I appreciate your time and think I am good for now
You may also want to check out this section about Subscription events: https://stripe.com/docs/billing/subscriptions/overview#subscription-events
It's a good reference and mentions all of the events typical integrations listen to when it comes to Subscription-related events.
Always happy to help! Let us know if you need anything else!