#Rajshree - Error

1 messages ยท Page 1 of 1 (latest)

mild yarrow
#

HI ๐Ÿ‘‹

lean fox
#

hi

mild yarrow
#
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

lean fox
#

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?

mild yarrow
#

Okay so both the Customer and the Subscription need to be brand new. Is this an existing Subscription?

lean fox
#

I am creating new subscription via api

#

using the test_clock parameter

mild yarrow
lean fox
#

ok, how about subscription?

mild yarrow
#

The subscription is created for a Customer. The Customer is the object that holds the relation to the Test Clock

lean fox
#

ok, that means addeding test_clock to customer is enough?

#

adding*

mild yarrow
#

Yes

lean fox
#

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?

mild yarrow
#

What is the value you are passing in for the ID? It appears to be using the wrong type

lean fox
#

its a valid id which is present in Stripe

mild yarrow
#

But the type appears to be invalid

#

That is what this error is telling you

lean fox
#

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?

mild yarrow
#

That subscription exists with an associated test clock.

#

I'm not seeing a related schedule though

lean fox
#

Shouldn't the schedule be part of test_clock if subscription is?

mild yarrow
lean fox
#

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

mild yarrow
#

I need to step away but @restive walrus will be able to answer further questions

lean fox
#

sure, Hi @restive walrus

restive walrus
#

Hi there ๐Ÿ‘‹ please bear with me a moment while I get caught up.

lean fox
#

sure, thanks

restive walrus
#

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?

lean fox
#

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

restive walrus
#

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?

lean fox
#

So the subscriptionSchedule.retrieve works if the test clock is not advanced

#

but once its advanced to any date, it gives above error

restive walrus
#

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.

lean fox
#

what is single phase?

#

how should this be handled ?

#

Could you suggest the right parameters for the Schedule object creation?

restive walrus
#

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.

lean fox
#

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

restive walrus
#

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.

lean fox
#

Makes sense. Thank you. I have one more related query. Can I also have the payment method object with the test-clock to simuilate the payment failures?

#

Are there other ways in which we can simulate the payment failures in Stripe