#SenorKarlos - expand
1 messages ยท Page 1 of 1 (latest)
Heya i was just editing as you replied LOL
What exactly are you trying to expand? Just the subscription object?
If so, it should be expand:[ "data.subscriptions" ]
I need to parse a list of customers and compare their subscription price plans to config values to assign and remove discord roles
I'm accessing the customer list object
Have you tried my suggestion above?
considering the customer list doesn't return a list of subscriptions... no O.o lol
I'm about to try what I reasoned with tracer code, are you sure you know what I was asking? ๐ :p
(which failed ๐ ) things need to make sense to me, I'll try it but I don't understand it
considering the customer list doesn't return a list of subscriptions... no O.o lol
If you useexpand:[ "data.subscriptions" ], it does.
๐คฆโโ๏ธ sorry LOL
I don't get why though, I thought you had to call the item you were looking for and it warns about 4 lvl depth, and that just expanded an object 4 layers deep from an object 'address' that doesn't 'exist' as I understand LOL
I think it did anyways, I'm going to put a tracer in for the actual sub data object, forgot console log doesn't form out all the trees
So did it solve your issue?
it's an ontime function in the main script, just ran. got an error looking for the property I would expect, but I don't seem to know much ๐
Note that using expand:[ "data.subscriptions" ] will show thesubscriptions object only if the customer has at least one subscription. But if you are listing all customers, many probably don't have one.
which is fine, the parse logic later handles that
assuming i can get the damn property right to see if I have it ๐ this is embarrassing ... i'm so new at all this
No worries! And can you clarify exactly which property you are looking for?
I was being dumb about it tbh, I was trying to log the subscriptions[0].data object up in the list function, and wasn't indexing something right in the prefixing or always indexing a test cx with no sub
I've moved it into the parse logic, which if it makes it there... I've already won I guess lol
Great!
well that looks like a big ol subscription object with the plan.id available ๐
i still don't quite get what's goin on with the expand thing, but it works lol. expand just looks for any property in the objects below matching that partial address?
I'd also then assume I should change my less used single fetch to what you just told me? ๐
stripe_js.customers.retrieve(
customer_id, { expand: ['customer.subscriptions.data'], },
i still don't quite get what's goin on with the expand thing,
When listing customers, by default you getdata[]that contain customer objects. if you want to expand the subscription of the customer, you need to useexpand:[ "data.subscriptions" ]
but to my poor brain just learning objects, data contains data[].customer lol
so calling something "that doesn't exist" at that address. If i tried to log "data.subscriptions" i'd get undefined
I'm just glad it works at this point tbh ๐ something something api magic
now I'm trying to figure out why my code prints a verification twice, but that's not a question for here ๐ ROFLMAO
thanks for the help and the patience with me, I don't express confusion well initially
workin on that
Happy to help ๐
have a great day!