#snetsunts - Sub
1 messages ยท Page 1 of 1 (latest)
Then what is the minimum frequency?
1 day
I need to test failed payment charging functionality ( smart retries )
how would you suggest to test that?
This is set on the Price object. You can see the available optiions here: https://stripe.com/docs/api/prices/create#create_price-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.
Failed Payment retries are a different thing altogether
Okay here's my case
- user has X subscription which invoice failed at the end of subscription ( invalid card )
- user updated his card later
- user downgraded his subscription to Y
- a few days later was also charged for an old subscription
How would you suggest to test this scenario?
I would suggest you use our webhooks feature to catch when the user updates their card
https://stripe.com/docs/webhooks
And set the new one as the default for invoices on the subscription.
I think you did not get my point. I need to mark previous subscription invoice as uncollectible and cancel it ( because user has new subscription, no need to charge him for that )
My issue is with testing. The codebase for this is ready, I just wonder how can I test this ( it's already 4 hours I can't find the right way )
Hi, snufkin is stepping out but I can help out. What issue are you running in to with testing this?
Are you running in to an error or are you blocked on figuring out how to set some of this up?
Hi @boreal solstice
I need to have a case when user has past_due subscription which latest invoice was failed. So I can handle it's invoice.payment_succeded event after attaching valid card and changing subscription
sounds like Test Clocks...
Yes definitely use test clocks if you were not already planning to. https://stripe.com/docs/billing/testing/test-clocks
Do you know how you want to set up the subscription to be past_due and all that? IIRC the easiest way would be to create a subscription with a ten second free trial on a customer that uses our "Decline after attaching" test card https://stripe.com/docs/testing
That will allow the subscription to start but when the first actual payment occurs the first invoice should go to past_due and you can test your recovery logic from there
Is that all helpful?
I'll try.
Of course that's helpful, thank you very much for your response ๐ค
And one thing also. What's IIRC exactly? Could you please some document so I can figure that out?
Whoops. That is an acronym for "if I remember correctly"
So I was just saying that that was the easiest way I could remember off of the top of my head