#kekko7072-subscription
1 messages · Page 1 of 1 (latest)
i use a subscription with amount for a rent service as bike sharing
so the user after the session upload the record of the amount usage
using POST /v1/subscription_items/si_sass/usage_records
so at the end of the month the usage is resetted in stripe subscription
an i want to rest it also in my database
but in customer.subscription.updated i don't have this value of amount
Got it! There's no webhook event to know when the usage record is resetted. However it should be reseted when a new billing cycle starts! And you could track that when the event invoice.paid is sent.
You can learn more about how to track an active subscription here: https://stripe.com/docs/billing/subscriptions/webhooks#tracking
ok so i sould reset when a invoice.paid ?
and another question, when i add a credit card to customer is also updated for the subscription or i should call and endpoint or webhook event
and what is the difference between invoice.paid and nvoice.payment_succeeded
ok so i should reset when a invoice.paid ?
The usage record are resetted at the beginning of the new billing cycle. So you can either keep track of when that happens on your end, or use theinvoice.paidevent yes. If you useinvoice.paid, I would recommend to calllistUsageRecordSummariesto check if the latest record usage is indeed at zero. https://stripe.com/docs/api/usage_records/subscription_item_summary_list
and another question, when i add a credit card to customer is also updated for the subscription or i should call and endpoint or webhook event
Can you clarify the question? I'm not sure to understand
if a user edit it's payment method adding a new card
and removing another one
is automatically updated also in the subscription?
and last question, if the user hasn't payed the billing 'invoice.payed' isn't called right?
it depends how exactly you build the process for the customer adding their new card, but generally yes, you'd build it in such a way that the subscription starts charging the new one.
invoice.paid, but yes, right.