#nstripe0_best-practices
1 messages ¡ Page 1 of 1 (latest)
đ Welcome to your new thread!
â˛ď¸ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
âąď¸ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
đ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1265064849189376062
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- nstripe_paymentintent-returnurl, 3 days ago, 10 messages
Hi there
I recommend working with Test Clocks: https://docs.stripe.com/billing/testing/test-clocks/api-advanced-usage?dashboard-or-api=api
You can create a Test Clock and create a Customer and Subscription within that "parent" clock. You can then advance the time on that Test Clock to see the objects (Invoices, PaymentIntents) and Events created when the Subscription cycles
Hi roadrunner
If I try that with an existing subscription, would my subscription be deleted at the end of that test clock usage?
I think I tried that before and was surprised about that.
It looks like creating the Test Clock first is what is recommended, which seems like it implies the application would need to be modified to understand the concept of a test clock running when the customer and subscription are created?
Yes, there is some automatic deletion that occurs on test mode Subscriptions, regardless of whether these are managed by a Teest Clock or not: https://support.stripe.com/questions/test-mode-subscription-data-retention
the application would need to be modified to understand the concept of a test clock running when the customer and subscription are created?
What do you mean by this exactly?
Our application's integration creates Stripe Customers and Stripe Subscriptions as part of users signing up and subscribing.
In order to create these associated to a test clock, it seems like our application integration code needs to be modified to understand that it is running under a Test Clock simulation?
This guide seems to assume that we would be simulating directly on the Stripe Dashboard, rather than our application.
Ah, I tried to link to the API tab specifically: https://docs.stripe.com/billing/testing/test-clocks/api-advanced-usage?dashboard-or-api=api
In step 1, you should see "Dashboard" and "API" tabs; select "API" in this case
it seems like our application integration code needs to be modified to understand that it is running under a Test Clock simulation?
Yes, you'll need to create a Test Clock first: https://docs.stripe.com/api/test_clocks/create
Then create a Customer and pass a value fortest_clock: https://docs.stripe.com/api/customers/create#create_customer-test_clock
Lastly, create a Subscription for that Customer
It's not possible to programmatically update an existing Customer (or Subscription) to use a Test Clock.
Hmm, maybe I'm talking about the "Run a simulation on this subscription" flow.
As described out in this guide: https://docs.stripe.com/billing/testing/test-clocks/simulate-subscriptions
I think that's what I tried before on an existing Subscription.
I see, okay. But yes, Test Clocks are the way to go here. The page you shared is specifically for Dashboard testing
Ok, I think when I tried that before, my Stripe Subscription and Stripe Customer ended up being deleted after running a simulation. That was the part that surprised me.
I'll give it a try again to see if I can better understand how to use this.
Got it. Yes, if you click "Finish simulation", the Customer and Subscription objects will be deleted
Is there a way to finish a simulation without having it delete the objects?
You don't have to click "finish a simulation". Leaving the simulation in a frozen time/state doesn't hurt anything and you can always come back to those objects (within the 90 day retention period) or delete them manually
Or you can mark a test mode Subscription exempt from retention
I see, that's helpful, thank you.
Happy to help!