#Rajshree - Error
1 messages ยท Page 1 of 1 (latest)
hi
stripe.SubscriptionSchedule.create(from_subscription=stripe_sub['id'],
File "/usr/local/lib/python3.9/site-packages/stripe/api_resources/abstract/createable_api_resource.py", line 22, in create
physis-backend | response, api_key = requestor.request("post", url, params, headers)
physis-backend | File "/usr/local/lib/python3.9/site-packages/stripe/api_requestor.py", line 122, in request
physis-backend | resp = self.interpret_response(rbody, rcode, rheaders)
physis-backend | File "/usr/local/lib/python3.9/site-packages/stripe/api_requestor.py", line 399, in interpret_response
physis-backend | self.handle_error_response(rbody, rcode, resp.data, rheaders)
physis-backend | File "/usr/local/lib/python3.9/site-packages/stripe/api_requestor.py", line 159, in handle_error_response
physis-backend | raise err
physis-backend | stripe.error.InvalidRequestError: Request req_IJMkcBG0WSo6bC: Received unknown parameter: test_clock
Putting this here so we have the full context
sure
I am able to add the customer to test-clock
but above error occurs when i try to add subscribtion or schedule
Could you pls guide how to test with test clock?
Okay so both the Customer and the Subscription need to be brand new. Is this an existing Subscription?
Okay but you cannot pass test_clock as a parameter when creating the Schedule. https://stripe.com/docs/api/subscription_schedules/create
ok, how about subscription?
The subscription is created for a Customer. The Customer is the object that holds the relation to the Test Clock
Yes
physis-backend | curr_sub_sched = stripe.SubscriptionSchedule.retrieve(curr_sub['schedule'])
physis-backend | File "/usr/local/lib/python3.9/site-packages/stripe/api_resources/abstract/api_resource.py", line 12, in retrieve
physis-backend | instance.refresh()
physis-backend | File "/usr/local/lib/python3.9/site-packages/stripe/api_resources/abstract/api_resource.py", line 16, in refresh
physis-backend | self.refresh_from(self.request("get", self.instance_url()))
physis-backend | File "/usr/local/lib/python3.9/site-packages/stripe/api_resources/abstract/api_resource.py", line 35, in instance_url
physis-backend | raise error.InvalidRequestError(
physis-backend | stripe.error.InvalidRequestError: Could not determine which URL to request: SubscriptionSchedule instance has invalid ID: None, <class 'NoneType'>. ID should be of type str (or unicode)
I get above error now, when I am trying to access the Subscription schedule?
What is the value you are passing in for the ID? It appears to be using the wrong type
its a valid id which is present in Stripe
sub_1LDutJEI3ln3HtoVRwOKoFjk
the type is invalid becasue its None Type
that means the stripe subscription['schedule'] value is None
could you check if it has the schedule value in Stripe?
That subscription exists with an associated test clock.
I'm not seeing a related schedule though
Shouldn't the schedule be part of test_clock if subscription is?
Do you have a subscription schedule ID? The value you provided is the ID for the Subscription.
https://stripe.com/docs/api/subscription_schedules/retrieve
curr_sub_sched = stripe.SubscriptionSchedule.retrieve(curr_sub['schedule'])
above failed , so I dont have it
without test_clock this works fine and gives an schedule
I need to step away but @restive walrus will be able to answer further questions
sure, Hi @restive walrus
Hi there ๐ please bear with me a moment while I get caught up.
sure, thanks
Apologies, I understand that this is related to Subscriptions, Subscription Schedules, and Test Clocks, but I'm struggling to understand what the current concern/question is. Would you mind summarizing for me?
Sure
I am trying to simulate different scenarios in future for stripe subscriptions
via api
I have created the customer using parameter test_clock
and now the customer and the associated subscription are part of the test_clock
but when I advance the clock in dashboard and try to retrieve the subscription schedule, it gives NoneType
Alright, so it sounds like you're able to create Customer and Subscription within the Test Clock. Were you able to successfully create a Subscription Schedule in that Test Clock as well?
So the subscriptionSchedule.retrieve works if the test clock is not advanced
but once its advanced to any date, it gives above error
Ah, I think I see what happened.
It looks like the Subscription Schedule had a single phase with an end date in Sep 2022 and an end_behavior of release. So now that the Test Clock has been advanced to Feb 2023, the Subscription Schedule has completed and it released the Subscription when it did.
So now the Subscription exists on its own and is currently not related to a Subscription Schedule.
what is single phase?
how should this be handled ?
Could you suggest the right parameters for the Schedule object creation?
Sorry, I'm not sure what you mean. What are you ultimately trying to accomplish here?
You have a Subscription (sub_1LDutJEI3ln3HtoVRwOKoFjk) that previously had a Subscription Schedule created from it (sub_sched_1LDutMEI3ln3HtoVKLiESWht), but then time moved forward and the Subscription Schedule finished and released the Subscription.
The subscription here is a recurring monthly payment so not sure why its single phase until sept 2022 only?
I would assume it to be non-ending with monthly payments unless user cancels the subscription
You don't need a Subscription Schedule for that, that is the basic behavior of our Subscription objects.
Subscription Schedules are used for scheduling changes that should be made to Subscriptions at points in the future.
The Subscription remained active and invoiced the Customer monthly until the Customer object was deleted with this request:
https://dashboard.stripe.com/test/logs/req_RsScNMJuMxDuGz