#tbm-subscription-cli

1 messages · Page 1 of 1 (latest)

queen otterBOT
verbal stream
#

@stoic kernel how can I help?

stoic kernel
#

I noticed that when stripe makes a subscription payment there are a whole bunch of events that it sends to the webhook.

#

Could one use the charge.succeeded event since it seems to also fire that event too?

verbal stream
#

You could, yes. The charge object included in the charge.succeeded event will include the invoice ID

stoic kernel
verbal stream
#

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?

stoic kernel
verbal stream
#

Hm, can you share the subscription ID?

stoic kernel
verbal stream
#

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

stoic kernel
stoic kernel
verbal stream
#

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

verbal stream
#

@stoic kernel let me know if this helps!