#Zeel Darji

1 messages ยท Page 1 of 1 (latest)

zenith mirageBOT
pliant plover
#

The subscription changes will occur based on the billing period when you advance the clock

mortal sleet
#

How do I check my next month subscription?

pliant plover
#

Can you clarify if you just want to preview upcoming month's invoice or actually move the test clock to next month?>

mortal sleet
#

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.;

pliant plover
#

You can advance the test clock and that should trigger appropriate events for the subscription

mortal sleet
#

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?

pliant plover
mortal sleet
#

Yeah I see but bit confused

pliant plover
#

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

mortal sleet
#

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

pliant plover
#

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}
);```
mortal sleet
#

okay thanks