I'm testing failing recurrent payments with Stripe Api.
To make recurrent payment fail soon after subscription creation, subscription itself should have trial period and trial_end on customer creation should be some time soon or string 'now'.
It I pass string 'now', card is charged right on Stripe.customers.create(), making it fail that isn't my objective.
Instead, I tried to pass current unix timestamp +10 seconds, but it seems that machine clock is set earlier on couple minutes that Stripe clock.
As a result, I get trial_end 1454753552 and trial_start 1454753109 that isn't 10 but 443 seconds.
Is there any other way to make test environment independent than changing system clock?
I'm using moment().unix() + 10
to get current unix time + 10 secs and nodejs.
For anyone in the future. Stripe has now introduced "Test Clocks" to help with this kind of situation. You can set a simulation environment at a specific time while continuously advancing the clock to create scenarios. You can learn more about it here