#andrei4002
1 messages · Page 1 of 1 (latest)
tried override, but it looks like it has the same behavior
Hmm thought that would work. One sec let me check
Ahh doh
That trigger doesn't generate a Subscription
So what you can do here is actually use the --edit flag if you want (https://stripe.com/docs/cli/trigger#trigger-edit) and open up the fixture in your own IDE and then edit it to generate a Sub and use that Subscription ID
Alternatively, it might be easier to just test this by creating a Subscription and then attempting to pay the invoice with a failing card like the 4000000000000341 that declines after attaching
the actual scenario i'm trying to simulate is after a user got his subscription working, the regular time interval passes, and it's time for stripe to charge the user again, and the payment fails
Gotcha so what you could do is to use a test clock to test this
And you can update the Customer's paymentmethod to the one above after the initial payment
Otherwise, you can adjust the fixture as I mentioned above
was looking at the test clock feature, but it only seems to let me create a new customer, and not pick an existing one, is this how it's supposed to work?
Yes that's correct
not really sure how to use the clock though, i tried creating a customer and a monthly subscription, i advanced the time by 1 month and got a few webhooks , "invoice.created" among them. shouldn't i also get invoice.paid ?
You should if the Invoice has been paid
Do you have an example Subscription ID that I can look at?
Yeah so looks like the renewal hasn't triggered yet
Try advancing time a bit more
oh. now it worked
Yeah test clocks can be slightly finicky with exact time
So usually going a few hours past the renewal date is what you want to do
i actually advanced time by 3 days past the regular biling time, and got to the same draft behavior
Hmm I see the invoices for that Sub have finalized
And you successfully triggered your invoice.payment_failed event
yep. i had to do another advance for some reason, but i can work with that
so i think i can use the test clocks in this manner. i got a few more not so related questions though, maybe you could help me
if a subscription payment fails and the user doesn't do anything about it, does the subscription get into an expired state automatically at some point?
and if it gets in that point, can it be reactivated?
That is all dictated by your retry settings at https://dashboard.stripe.com/settings/billing/automatic
If a Subscription is canceled then it can't be reactivated
You may want to take a look at https://stripe.com/docs/billing/subscriptions/overview#subscription-statuses to get a better sense of how to handle the different statuses