#KEITH LARD
1 messages · Page 1 of 1 (latest)
Hi 👋 if you're trying to test a Subscription moving into a past due state, I would recommend using Test Clocks for that. They allow you to create Subscriptions in sandboxes where you can manually advance time and see how those objects will behave in the future:
https://stripe.com/docs/billing/testing/test-clocks
Hi toby, I cannot do this unfortunately as there is some metadata I need to set and data on my side which I cannot set with the test clocks, is that the only solution?
Is it possible to use test clocks with an existing sub, say I advanced the one I just made by 1 day
No, you cannot use an existing Subscription with a new Test Clock, you will need to create a new Subscription. Test Clocks don't prevent features like metadata from being usable, you could still leverage that in your testing.
Cool I'll give it a go thank you
How can I set metadata when I create it in the dashboard? I dont see the option
Oh, I'm not sure if that is possible through the dashboard (we primarily focus on leveraging APIs in this channel).
I'm not seeing a way to add metadata during creation, but I see an Edit metadata button that is available on the Subscription's page once it has been created.
Cool found it thanks for the help
Any time!
Sorry one more question, when I create a sub in my normal flow I pass the $subscription->latest_invoice->payment_intent->client_secret to my checkout to generate it (payment element)
Do I do the same thing for past_due subscriptions?
I am getting
Trying to get property 'payment_intent' of non-object
when I do that with past_due subs
I believe that is still right, can you share the ID of the Subscription you're using for testing so I can take a closer look?
sub_1NAv7sAjtNFaRAYonNQhJvnH
Do I need to expand latest_invoice or something after I retrieve?
Yes, if you're trying to retrieve the Payment Intent's client secret with a single request by retrieving the Subscription, then you will need to expand latest_invoice on the Subscription, and the payment_intent field on the Invoice. I believe you can do that by expanding latest_invoice.payment_intent
I've realised I've done exactly that on my original flow when I make it 🤣 sorry im a dum dum
thank you
And when a payment is successful for a past_due sub, I'm assuming I need to make that the default payment method for the subscription? And everything else status logic wise should be handled automatically
Yeah, if the customer is providing new payment method details to be used for Subscriptions moving forward, then setting that Payment Method as the default would be good. The Subscription will then try to use that saved Payment Method for its next billing period's payment.
perfect thanks again for the help