#krishna008
1 messages · Page 1 of 1 (latest)
what event type are you listening for?
stripe trigger subscription_schedule.updated
why not listen for the subscription.updated event instead?
ohh is it for the each month subscription payment. I mean I want to listen event when subscription amount is paid each month.
it's customer.subscription.updated
or alternatively, you would may want to listen for the invoice.paid event : https://stripe.com/docs/billing/subscriptions/webhooks#events and check. the billing_reason : https://stripe.com/docs/api/invoices/object#invoice_object-billing_reason
The event ‘customer.subscription.update’ is not supported by the Stripe CLI.
you can always use the Billing Clock, create a Subscription and then advance the time on the Billing Clock to see what's returned in the events
you can still test it locally, events generated will be forwarded to your localhost still
So using advance clock I can charge subscription anytime
you can simulate what will happen at a certain period of time because you can advance the clock
Using CLI having some issues
Is there any different command for that?
CLI doesn't support generating that event. There's no way to do it using the CLI
Okay sir.
I am using connected account. Is it possible to trigger that event for connected account.
yes, like what I mentioned before, you can use the test Clock, create a Subscription and then advance the time on the Billing Clock to see what's returned in the events
https://stripe.com/docs/billing/testing/test-clocks
i'll suggest listening for invoice.paid too, to see if that's an event which you want to use too
Now
I am at India so If I want to make this subscription charge now what will I have to do sir?
you advance it to a date in the future
Sir, I did not understand this concept.
If I want to charge subscription now do I have to set current time?
a test clock is to simulate time passing
so you can advance the time to simulate time passing
if you want to charge it now, then try advancing the time to a few hours past
if you want to see it charge 1 month later, then advance the time to a future date i.e. 1 month later
I will try this one.
I have simulate time in the past but
Webhook has not hit
can you share the subscription id?
sub_1OOgceDBfYojrB0Wo9YN61Jw
Hello
👋 Taking over this thread, catching up now
I have resolved the issue.
But I am not able to use singnature.
const sig = req.headers["stripe-signature"];
let event = req.body;
Secure webhook using signature and endpoint secret.
try {
event = stripe.webhooks.constructEvent(req.body, sig, endpointSecret);
} catch (err) {
console.log("HERE 3 ERROR", err.message);
res.status(400).send(`Webhook Error: ${err.message}`);
return;
}
I am getting error
No signatures found matching the expected signature for payload. Are you passing the raw request body you received from Stripe? https://github.com/stripe/stripe-node#webhook-signing
Are you passing the request body in the raw form? More specifically express.raw({type: 'application/json'}) in
app.post('/webhook', express.raw({type: 'application/json'}), (request, response) => {
let event = request.body;
Reference: https://stripe.com/docs/webhooks/quickstart
In your middleware, do you parse all requests in json prior to this? For example,
app.use(express.json());