#taylan-sub-schedule

1 messages ยท Page 1 of 1 (latest)

late tinsel
echo gazelle
#

I just want to know more about what phase means

#

why it has 2 plan

late tinsel
#

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

echo gazelle
#

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?

late tinsel
#

can you share the subscription_schedule ID so that I can give you specifics on this?

echo gazelle
#

sub_sched_1KeKQaGBhi4wdnXz1GAb1cQm

#

get /v1/subscription_items endpoint provides me details about product?

slow warren
#

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

echo gazelle
#

how should I write it with php

slow warren
#

You can toggle the language of the example in the top right to PHP

echo gazelle
#

Does this look okey?

slow warren
#

Yes that looks right to me.

echo gazelle
#

This property cannot be expanded (items)

#

I am getting this error

slow warren
#

Can you try phases.items.price instead of separating them?

echo gazelle
#

works like charm thank you

slow warren
#

๐ŸŽ‰

echo gazelle
#

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?

slow warren
#

What are you trying to do with it?

echo gazelle
#

I am trying to get the product name/id basicly

#

from here

slow warren
#

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?

echo gazelle
#

$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

slow warren
#

Whoops I misread your code and used the wrong variable.

#

$phases_items_price->phases[0]->items[0]->price->product

echo gazelle
#

๐Ÿ‘ It's okey I guess thank your for your help

slow warren
#

Is what I meant