#brettski - Subscriptions

1 messages · Page 1 of 1 (latest)

manic lodge
#

Hello! I think it is, but let me confirm...

crystal roost
#

Thank you. I tried the docs, but it wasn't clear

manic lodge
#

Yep, it does. These are the values that get updated:

  "previous_attributes": {
    "current_period_end": 1633071600,
    "current_period_start": 1630479600,
    "latest_invoice": "in_1JUnQyLieeNbcBYspJ3blZ8B"
  }
crystal roost
#

How did you find that?

manic lodge
#

I have a test account with several Subscriptions. I checked to see if customer.subscription.updated events were firing and they were.

crystal roost
#

that'll do it :p

manic lodge
#

For Subscription renewals/when a new period starts I mean.

crystal roost
#

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?

manic lodge
#

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?

crystal roost
#

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.

manic lodge
#

Gotcha. I recommend listening for invoice.paid to know when people pay for a Subscription renewal.

crystal roost
#

But then I need to figure out which subscription it is for. I was really hoping I could listen around the subscription itself.

manic lodge
crystal roost
#

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?

manic lodge
#

Checkout doesn't generate Invoices. It either uses Payment Intents (for one-off payments) or Subscriptions.

crystal roost
#

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

manic lodge
#

Always happy to help! Let us know if you need anything else!