#SenorKarlos-expand

1 messages Β· Page 1 of 1 (latest)

shadow dew
#

πŸ‘‹ Happy to help

pastel violet
#

sure

#

req_qsagGfg74GxoNo

#

that particular session was for a payment mode one, do I have to be specific in my function call?

#

I figured you could just request all expandables and it'd skip anything not present

shadow dew
#

I see where the problem is

#

You don't have put .data. The fields for expansion follows the field name

#

In this case, it'll be ['subscription']

pastel violet
#

ohhh. I presume same for payment_intent then as it isn't an empty object array setup in the first place?

#

I think I'm starting to get some of this bahaha

shadow dew
#

Yup, so it'll be expand: ['line_items','subscription','payment_intent']

#

In any case if the object is present, it'll be expanded

pastel violet
#

Excellent! And it'll return like a .data item afterwards right, so addressing would be checkout.payment_intent.data[0].charges.data[0].id to find the charge ID on a payment mode success

#

(charges being a default expanded object of payment_intent)

#

πŸ˜‚ shit I might not even need 'subscription' expanded now that I'm reviewing my provisioning code again... I would have got the error on p_i anyways, but I really only needed subscription for the price_id matching and I get that from line_items

shadow dew
#

what do you want to achieve?

pastel violet
#

I'm offering one-time access purchases and subscription access purchases, and the customer status in my database determines if they keep the Discord role assigned

for one-timers & subs I need to line up the price_id from an array of available prices, and assign the associated role. For one-timers I also want to record the charge ID and create an expiry based on the charge created+a pre-set unix value, then later be able to check charge.refunded hooks and pull the charge id as part of the database verification the bot does

#

subs are easy, just listen for updated and deleted, but I need to make sure if they charge back a one-time the role/price/expiry get removed

#

I took two low code examples and an extremely outdated stripe bot and made this monstrosity well beyond my scope πŸ˜‚ amazed I'm still here tbh

#

πŸ˜‚ well that addressing failed, but I have console logging to figure it out from\

#

ahh ok so when you expand a string to object, it doesn't get the fancy list and data[] shebang, it just literally becomes an object

#

Holy shitballs I just fully provisioned myself πŸ˜‚ πŸ₯³

#

Thanks for the help and ear πŸ˜„ lol

shadow dew
#

That's awesome!!! Great to hear that everything works 🀩

pastel violet
#

πŸ’ͺ not bad for not a developer eh. Gonna have to stop saying that soon πŸ˜