#tbm-subscription-cli
1 messages · Page 1 of 1 (latest)
@stoic kernel how can I help?
I noticed that when stripe makes a subscription payment there are a whole bunch of events that it sends to the webhook.
However this link https://stripe.com/docs/billing/subscriptions/build-subscriptions?ui=elements&element=payment#webhooks reccomends using the invoice paid event.
Could one use the charge.succeeded event since it seems to also fire that event too?
You could, yes. The charge object included in the charge.succeeded event will include the invoice ID
Ok thanks, that makes things simpler. The only problem i have is that the test one didnt send the event to my webhook. I had to check the events on my dashboard.
The charge object doesn't include the subscription ID, however. If you need the subscription ID, you'd need to make a call to retrieve the subscription ID
Ah, I see. Is your webhook configured to receive charge.succeeded?
Yes. Its works when i pay the subscription using the browser but my subscription is set to pay daily and tommorrow it wont send me the data.
Hm, can you share the subscription ID?
i think it might be this sub_1MVS2tAzmUeIjfIFaDV9XWfs
Hm, I see two invoices for this subscription. The invoice payments for both ended up triggering charge.succeeded events
I see you're listening to events with the Stripe CLI only. This means you'll need an active terminal window running stripe listen to receive these events
What do you mean by active? Will it not work if i close my laptop?
Not shut down but just folded without closing anything down.
Let's take a step back. The Stripe CLI can be used to trigger events and listen for specific events. You can forward the events to local endpoints in order to test any webhook handler logic you have in place.
Testing subscriptions gets a little tricky due to the time aspect (e.g. how can you easily test a monthly or annual subscription?)
This is where test clocks come in: https://stripe.com/docs/billing/testing/test-clocks
You can set up a billing simulation, listen locally for events using the CLI, then advance the time on your simulation. This way, you don't have to wait for a full billing period before you can test billing logic and any webhook handlers you have in place
@stoic kernel let me know if this helps!