#knuppi-subscription-events

1 messages ยท Page 1 of 1 (latest)

waxen basaltBOT
#

Hello! We'll be with you shortly. Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.

pseudo jay
#

Are you deleting an item (by passing deleted: true) or updating an item with a new price?

kind gazelle
#

We are deleting by passing deleted: true, yes

#

POST data: {'id': 'sub_1OZK8LDCZJ2TeDMZmyQvoFbh', 'items': [{'id': 'si_PO6M3ZVmwZKB3U', 'deleted': True}]}

#

I only receive these webhooks back to my CLI:

event.type='invoiceitem.created'
event.type='customer.subscription.updated'
pseudo jay
#

Hm, I think you might be passing the wrong subscription item ID in your update request

kind gazelle
#

I added, and later removed, an addon to the subscription

#

Problem is that I don't receive a webhook, and looking through the webhook docs there seems to be something like invoiceitem.deleted which I never receive

#

But if I click the Delete-link on the product through the Dashboard, then I reckon that I see the webhook

pseudo jay
#

Ah, I see. I missed the addition of the one-time item

kind gazelle
pseudo jay
#

What's your ultimate goal here? I think what ended up happening when you added then removed the one-time price is that a proration was created. See the "Remaining time on Menu after 16 Jan 2024" and "Unused time on Menu after 16 Jan 2024" lines in the upcoming invoice details in the Dashboard

kind gazelle
#

the use-case here is that we are a platform hosting multiple standard accounts. we have different tiers (products) which they can subscribe to. we also have addons, such as "newsletter" or "questionnaire" which they also can add to their account for enhanced experience

#

so, what i'm looking to do is for the account/customer, to allow them to add additional products to their subscription (this works, webhook also) but also to unsubscribe from the products (it works, but no webhook is sent)

#

my question is then; maybe i'm using the wrong approach here? instead of sending {"delete": true} and instead using some other endpoint?

pseudo jay
#

Gotcha. And the goal is to add on a "newsletter" not just to the next invoice only but to all invoices going forward unless explicitly removed?

kind gazelle
#

yes, exactly

#

all products have the same pricing structure - monthly (or yearly, but never mixed)

#

and quantity is always 1

#

@pseudo jay any feedback/ideas?

pseudo jay
#

also to unsubscribe from the products
Do you want them to be able to unsubscribe immediately or at the next billing cycle?

kind gazelle
#

preferably immediately, but it's OK if it's at the next billing cycle

pseudo jay
#

Gotcha

kind gazelle
#

What approach do you suggest?

pseudo jay
#

Give me a few more minutes. I think I'm missing something with regards to the request to delete that subscription item

kind gazelle
#

OK, I'll wait ๐Ÿ‘Œ๐Ÿพ

waxen basaltBOT
#

knuppi-subscription-events

pseudo jay
#

Okay, so passing deleted: true when updating a subscription item will not trigger the invoiceitem.deleted event as an invoice item is not being updated; in this case, a subscription item is being updated

#

The update you made will modify the next invoice. This explains why, if you look at the subscription in the dashboard, the upcoming invoice details shows the proration lines from adding and removing that subscription item

kind gazelle
#

yes, I see.
is there a way to accomplish what I'm looking for?

pseudo jay
#

So what you're doing is technically correct but I recommend inspecting the customer.subscription.updated event instead to see what changed

kind gazelle
#

Yes, but it's pretty difficult. It's a pretty comprehensive list and having to check every item in the list against what's in the database. also, there's no way to separate webhooks coming from Customers belonging to our Accounts and from our direct Customers

pseudo jay
#

separate webhooks coming from Customers belonging to our Accounts and from our direct Customers
I take it you're not using Connect webhooks?

kind gazelle
#

Are there Connect-specific webhooks?

pseudo jay
#

So I see you're using Connect but only have "Account" webhooks configured. If you are/will create Connected Accounts and want to know about events that take place on these Connected Accounts, I recommend setting up Connect webhooks, yes: https://stripe.com/docs/connect/webhooks

kind gazelle
#

OK, we will look into it

#

However, with multiple customers who will add/remove addons over time, imho it's not a clear/clean approach to loop through all objects in the customer.subscription.updated webhook.

#

Am I using a too old version of the API? I'm currently using 2022-11-15

pseudo jay
#

No, it's not an API version issue.

#

The invoiceitem.deleted event is only triggered when deleting an invoice item. So, once this subscription's next invoice is in draft state, if you delete the item that corresponds to the "newsletter" that that customer is removing, only then will you receive the invoiceitem.deleted event

kind gazelle
#

OK, so it seems that I should use the subscription_items/delete endpoint. It gives a direct reply to whether it was successful or not