#Zeel Darji
1 messages ยท Page 1 of 1 (latest)
Hello ๐
Frozen time refers to the time where the clock is currently at
https://stripe.com/docs/api/test_clocks/object#test_clock_object-frozen_time
The subscription changes will occur based on the billing period when you advance the clock
How do I check my next month subscription?
Can you clarify if you just want to preview upcoming month's invoice or actually move the test clock to next month?>
I am working in test mode so for checking subscription in local How can I able to test my next month subscription related webhooks?
So I need a way so I don't wait for next month & I try multiples events in local.;
You can advance the test clock and that should trigger appropriate events for the subscription
const testClock = await stripe.testHelpers.testClocks.create({
frozen_time: 1666022400,
});
Suppose I have created this for 4 PM GMT
So need to attach this clock with my already added subscription?
We have docs on this ๐
https://stripe.com/docs/billing/testing/test-clocks?dashboard-or-api=api
Yeah I see but bit confused
You'd create a new customer and a subscription for the test clock to setup the simulation
You can use your existing price IDs for the subscription
I'm clear with subscription and customer flow
Just want to confirm after this :
const testClock = await stripe.testHelpers.testClocks.create({ frozen_time: 1666022400, });
Subscription automatically triggers as testClock id binds
That code only creates a new test clock since you're using .create({... method
Creating a customer with the test clock and then creating a subscription with the same customer binds the subscription to the test clock.
email: 'jenny.rosen@example.com',
test_clock: '{{CLOCK_ID}}',
payment_method: 'pm_card_visa',
invoice_settings: {default_payment_method: 'pm_card_visa'},
});```
Hence whenever you advance the clock, the subscription will behave accordingly
```const testClock = await stripe.testHelpers.testClocks.advance(
'{{CLOCK_ID}}',
{frozen_time: 1667286000}
);```
okay thanks