stripe-payments

Test Stripe Subscription without trial


I am working with the Stripe API, and I’ve found it quite challenging to test subscription renewals. I need to simulate a charge on a user’s card at the end of the subscription period. Previously, we could set a very short trial period (e.g., 5 minutes), but now Stripe requires us to set it to at least 2 days in the future. This is a long wait for testing, and I would have to keep my server running 24/7 just to wait for this test.

Is there an alternative way to trigger the renewal of a subscription without having to wait for hours?

I tried to trigger something similar with CLI, but coudn't do it.


Solution

  • we could set a very short trial period (e.g., 5 minutes), but now Stripe requires us to set it to at least 2 days in the future.

    That's definitely still possible when using the direct Subscription API to set trial_end to a unix timestamp, but maybe you're using something like a CheckoutSession instead.

    The other/better way to test this is with TestClocks : https://docs.stripe.com/billing/testing/test-clocks