#deputycheese
1 messages ยท Page 1 of 1 (latest)
Hi there!
You have a few options.
For example you could replace the default payment method of the subscription by a test card that will fail, and then use Test clocks to move time forward
I tried using test clocks but how can I "run" them? I created one, but nothing happens
clock_1NkmrEClDK2O5WMjjgTGrkKL
I would like all webhooks to get called that would run until september 30th
Did you read the doc on Test Clocks I shared above? https://stripe.com/docs/billing/testing/test-clocks
It's a multi step process:
- Create the test clock
- Attach it to a customer
- Then move the time forward
It's not possible to use this in combination with a customer that I created via our system (cus_OXse7Dl0XgNNMf)?
Basically I only want those webhooks for his subscription to run to be able to test it
If I create a new one via stripe dashboard we cannot test anything because we havent got the data in our system (subscription etc.)
It's not possible to use this in combination with a customer that I created via our system (cus_OXse7Dl0XgNNMf)?
You can only attach a test clock to a customer while you are creating the customer.
However note that there's another option to test a failed renewal, without Test Clocks:
Create a subsciption with a very short trial period, like a couple seconds. As soon as the trial ends, the subscription will try to charge the customer; But if the customer has no default payment method or the payment method is one that will fail, then the payment will fail.
Ah cool
How can I do that?
I thought "day" was the least I could define there
I am using price_data >recurring > interval
Yes
So set the trial directly on the Subscriptoin itself with the trial_end parameter
Ah so I cant use https://stripe.com/docs/api/subscriptions/create#create_subscription-items-price_data-recurring-interval
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Thats how we currently create our subscriptions and Id rather have it as close to the live implementation as possible
I don't understand. You can use both price_data and trial_end.
trial_end will override the interval I specify in price_data?
There are two completely different things.
- interval is how frenquently you charge the user (daily, weekly, etc.)
- free trial is how long the subscription will be free
Ah ok so he wont be charged at first and then only with what i defined at trial_end, right?
Yes. For example if you set the trial_end 2 seconds in the future, then the first 2 seconds of the subscription will be free, and then after 2 seconds Stripe will try to charge the customer, which will fail (assuming they don't have a default payment method or you set one that will fail).
Perfect, thanks
Happy to help ๐
Thanks
I could also just cancel via stripe dashboard, that will call the same event right?
Yes you can cancel a subscription from the API or the Stripe dashboard, it's the same.