#taylan-sub-schedule
1 messages ยท Page 1 of 1 (latest)
Hello ๐
Subscription schedule is typically used when you want to automate changes to a subscription over time. Phases are used to define those changes.
So for example,
I want this subscription to cost X amount for Y period of time and then change it to Z amount
You can define phases for these scenarios to automate that
thanks
I have another question
Let's say I have triggered subscription_schedule.canceled event and catching it via api
how can I get the product attached that object?
can you share the subscription_schedule ID so that I can give you specifics on this?
sub_sched_1KeKQaGBhi4wdnXz1GAb1cQm
get /v1/subscription_items endpoint provides me details about product?
Hi there! Stepping in for @late tinsel who needs to step away. Yes retrieving the Subscription Schedule and expanding the price(s) for each phase will provide you with the product
how should I write it with php
We have snippets in our API Ref that you can work off of. Here is the retrieve snippet: https://stripe.com/docs/api/subscription_schedules/retrieve and to expand: https://stripe.com/docs/api/expanding_objects
You can toggle the language of the example in the top right to PHP
Does this look okey?
Yes that looks right to me.
Can you try phases.items.price instead of separating them?
works like charm thank you
๐
I have one little question
the result contains product key but its deep inside a nested array
How can I reach that [product] key?
[product] => prod_LL1zoaY3WsvjBD
Can I do it here?
What are you trying to do with it?
I'm not the best with PHP, but I believe it is something like:
$subscription_schedule_canceled->phases[0]->items[0]->price->product
Can you try that?
$subscription_schedule_canceled->phases[0] doesn't have items array
$phases_items_price has the [product] key
I was asking if I can give more params to retrieve method or some helper method to extract data out of it
If this is the way I will do it like this
Whoops I misread your code and used the wrong variable.
$phases_items_price->phases[0]->items[0]->price->product
๐ It's okey I guess thank your for your help
Is what I meant