#linhwin
1 messages ยท Page 1 of 1 (latest)
Hello! We'll be with you shortly. 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.
- linhwin, 15 minutes ago, 2 messages
curl https://api.stripe.com/v1/subscription_schedules
-u sk_t547fgu6u6u6urt6u32322:
-d from_subscription="{EXISTING_SUBSCRIPTION_ID}"
-X POST
That's the curl I'm using to set a subscription schedule to the subscription after a successful payment comes through.
Hello again ๐ did you happen to see my earlier message on the thread I created previously? I'll need more context on how you're currently trying to approach this, and what behavior/errors you're running into.
You should roll that secret key now that it has been shared publicly.
I'll roll it right now
๐ and so what's the problem that you're running into with the Subscription Schedule flow? It is expected that you'll need to make two requests for that process, one to create the Subscription Schedule from the Subscription, and then a second to update the newly created Subscription.
I cant seem to modify the current phase after creating the subscription schedule
the api wont let me
I tried another way too like this to end the current phase and start a new one immediately and it didnt work either
curl https://api.stripe.com/v1/subscription_schedules/<SCHEDULE_ID>
-u <YOUR_SECRET_KEY>:
-d phases[0][items][0][price]=<CURRENT_PRICE_ID>
-d phases[0][items][0][quantity]=<CURRENT_QUANTITY>
-d phases[0][end_date]="now"
-d phases[1][items][0][price]=<NEW_PRICE_ID>
-d phases[1][items][0][quantity]=<NEW_QUANTITY>
-d phases[1][iterations]=<NUMBER_OF_ITERATIONS>
-d phases[1][start_date]="now"
-X POST
What do you mean by "it didn't work"? Did you receive an error? If so, what did it say? Or did the request complete successfully but didn't do what you were hoping?
I'm stuck on the updating the subscription schedule part. I dont care how we do it, I just want to be able to control the number of iterations it suns
In the example above, I got this error:
"message": "The subscription schedule update is missing at least one phase with a start_date to anchor end dates to.",
Can you share the ID of the request (req_) that returned that request to you? So I can actually see what your code is doing/passing to us.
https://support.stripe.com/questions/finding-the-id-for-an-api-request
Find help and support for Stripe. Our support site provides answers on all types of situations, including account information, charges and refunds, and subscriptions information. Get your questions answered and find international support for Stripe.
Thank you, I think I see what's happening. It looks like the system didn't detect enough timestamps to know how to bound the schedule's phases. It's a little silly, because I'm pretty sure we won't let you update the start date of phase[0] (the current phase) but still expect you to provide it.
Can you try making that request again, but this time pass in phases[0][start_date] and set it to the same timestamp that's currently set to on the Subscription Schedule?
let me try
it finally worked
Since it is ending the current phase and starting a new one immediately, will the customer get charged twice? How does it work on that end?
Do you see the customer getting charged again in your testing? If you aren't making a change that pushes the Subscription into its next billing period, then I'm pretty sure you won't see them charged when you update the Subscription Schedule.
nope I dont see them get charged
so theoritically, if I do all of this on the same day, nothing changes on the customer end, other than the fact that their subscription have an end time now instead of running indefinitely?
doing all of this on the same day meaning charging a subscription via stripe checkout and then converting it into a subscription schedule with an end date
Yes, that sounds right, but I'd recommend testing to ensure. There are a lot of settings that can be used to change the behavior of Subscriptions, and it's hard to talk through every possible one and how it's currenlty set up for your account/integration.
I would recommend using our Test Clocks, which allow you to create Subscriptions inside of sandboxes where you can advance time, to test the full lifecycle of the approach you're using and make sure it behaves exactly as you're hoping:
https://stripe.com/docs/billing/testing/test-clocks
that's a good idea, thank you toby