#knuppi-subscription-events
1 messages ยท Page 1 of 1 (latest)
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.
- knuppi., 4 days ago, 31 messages
- knuppi., 4 days ago, 30 messages
- knuppi-connect-flows, 5 days ago, 94 messages
Are you deleting an item (by passing deleted: true) or updating an item with a new price?
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'
Hm, I think you might be passing the wrong subscription item ID in your update request
It seems to be the right one: https://dashboard.stripe.com/test/subscriptions/sub_1OZK8LDCZJ2TeDMZmyQvoFbh
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
Ah, I see. I missed the addition of the one-time item
Should I instead use https://stripe.com/docs/api/subscription_items/delete ?
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
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?
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?
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?
also to unsubscribe from the products
Do you want them to be able to unsubscribe immediately or at the next billing cycle?
preferably immediately, but it's OK if it's at the next billing cycle
Gotcha
What approach do you suggest?
Give me a few more minutes. I think I'm missing something with regards to the request to delete that subscription item
OK, I'll wait ๐๐พ
knuppi-subscription-events
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
yes, I see.
is there a way to accomplish what I'm looking for?
So what you're doing is technically correct but I recommend inspecting the customer.subscription.updated event instead to see what changed
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
What are the drawbacks of using https://stripe.com/docs/api/subscription_items/delete ?
separate webhooks coming from Customers belonging to our Accounts and from our direct Customers
I take it you're not using Connect webhooks?
Are there Connect-specific webhooks?
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
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.
What are the drawbacks of using https://stripe.com/docs/api/subscription_items/delete ?
I attempted it and it looks OK on the Subscription overview. However, it doesn't trigger a webhook either. https://dashboard.stripe.com/test/logs/req_vpp2TJucVGeKh7
Why is that?
Am I using a too old version of the API? I'm currently using 2022-11-15
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
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