#alexelba
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.
why do you want to modify the start_date of the current phase? Like what the error message mentions, you can't / shouldn't modify the start_date of the current phase
I want to add new phase, which will change the quantity
sure, but when do you want to add the new phase?
if you want to change the quantity now, then you don't need a subscription schedule right?
if you want to change the quantity later, then the phase where you're changing the quantity should be a second phase right?
end of the current period
okay, so you should just keep the first phase data as it is (which ends after 1 iteration) and add in a second phase that changes the quantity
If i do following -> \Stripe\SubscriptionSchedule::update(
$stripe_subscription_schedule->id,
[
'phases' => $stripe_subscription_schedule->phases,
'proration_behavior' => 'none',
]
);
without adding any new phase I get error invalid
Object
how do I keep existing phases if I can not copy from current object
what's the corresponding request id?
or if there's no request id, what's the full and exact error message
"Invalid object"
like which line is throwing this error, and what exactly is the invalid object. The full stack trace must have more info than just Invalid object
\Stripe\SubscriptionSchedule::update(
$stripe_subscription_schedule->id,
[
'phases' => $stripe_subscription_schedule->phases,
'proration_behavior' => 'none',
]
);
$stripe_subscription_schedule = \Stripe\SubscriptionSchedule::retrieve($stripe_subscription->schedule);
basically try to get it and call update with the same phases back
sub_sched_1O6K0hHxrjf17jEDq6eRucfE
sub_1O4sSTHxrjf17jEDSwXIcbmF
i'm sorry but you need to learn how to debug your own code. You're just giving us the entire code snippet and we can't do anything with that. A full stack trace of the error should at least contain the line that the error occurred at. At the very least, you need to track down which line and which variable is the invalid object in. Please either add additional logging, or step through your code in the editor to understand how your code works.
basically nothing to do with "my code"
I call your sdk, get object, can phases and pass back to your update method, and your sdk throws error for the object got back from it
this is all "my code does"
lines I copy was, basically call retrieve and call back update on the same dataset without any changes
You can't copy object in the response of a request to another new request. Not all parameters in a response are supported in the update request. I'd recommend only passing the required fields in the new request.
which of attributes should I re create to preserve previous phases
price, quantity, start_date, end_date?
Yup! items including price and quantity, start_date, end_date/iterations inside a phase
when creating schedule from_subscription it will not have iteration
You can either set iterations or end_date
ok thanks let me try