#ddbg-test clocks
1 messages ยท Page 1 of 1 (latest)
๐ happy to help
did you try using test clocks https://stripe.com/docs/billing/testing/test-clocks ?
it's a semi-new feature (a few months back)
that would give you the ability to test Subscriptions and Subscription Schedules
yes indeed
just bare in mind that only 3 subscriptions/subscription schedules can be created per customer when a test clock is used on that customer
yes but once the schedule hit, I can do again right? When you said 3, it's 3 on the "same time" right?
let me try to do my job better this time ๐
so if I understood it correctly, for my schedule new phase, I have to create a testClock to "simulate" that we are one month later, then give the testClock id in the newPhase?
So in order to use the test clock, you need to create one and attach it to a customer
ah, I'm not sure to get the point on the test clock :/
from that point the subscriptions/schedules you will create for that customer would be subject to the test clock
but can't I just fill the new phase with a custom timestamp for the periodStart?
and you can go into the future to get the new invoices
you will still be able to create the schedules that you want
the only thing that the test clock would do for you is the ability to travel into the future in order to see what happens when that date arrives
e.g. a new invoice will be generated, the new phase will be active, etc.
oki, but will that fire the hook about the subscription update?
I assume yes then
may I explain to you what I understood and how I can implement that?
yes sure
thanks @native viper !
I have a question that just came when I was resuming you what I understood
the testClock I have to attach it to the customer right (you said that above)?
but my user is created already
how can I attach the testCLock to it?
it's not possible to attach a test clock to an existing customer
you need to create a new one
oh crap :/
it's pretty tough on my side (back side) to create a new test customer and attach to it credit card (on the front side) :/
is there another way to apply a "custom" timestamp to accelerate a subscription.schedule?
actually if it's a test customer you can automatically create the customer with a payment method
but thanks a lot for teaching me about testClock, really good to know!
what dev language are you using on the backend?
nodejs
email: '...',
test_clock: test_clock.id,
payment_method: 'pm_card_visa',
invoice_settings: {default_payment_method: 'pm_card_visa'}})```
by using the payment method token pm_card_visafrom https://stripe.com/docs/testing?numbers-or-method-or-token=payment-methods you could setup the default_payment_method for the invoices of that customer
thanks a lot for the info!
let me know if you need any more help
oki thank you very much @native viper !!!