I am using the "Run payments with Stripe" Firebase extension for subscriptions. How can I test a subscription renewal payment success and a subscription cancellation due to payment failure ? Is there a way to attach this extension to the Stripe test clocks ? Thanks
Asked
Active
Viewed 274 times
0
-
I'm not seeing any prebuilt functionality for interacting with test clocks, but it doesn't look like that functionality is explicitly blocked either. I think you'll need to first create a test clock via the Dashboard or API https://stripe.com/docs/billing/testing/test-clocks#create-clock. Then see if there is a way to pass the ID of that test clock when you're creating the Customer objects in Stripe https://stripe.com/docs/api/customers/create#create_customer-test_clock. Have you tried to do something along those lines and run into problems? – toby Oct 04 '22 at 14:48
1 Answers
0
The extension does not offer a direct test clocks integration, however it could work:
- Create a test clock object directly with the Stripe API.
- Create a Customer object, passing the
test_clock
parameter. - Map the returned
cus_xxx
ID with your Firebase user in the related Firestore document. - Create a
mode: 'subscription'
Checkout Session with the extension, using the Firebase user mapped to the test clock customer.
From there you should be able to advance the resulting test clock (and associated subscription) as you need!

Jonathan Steele
- 1,502
- 4
- 7