#SenorKarlos-expand
1 messages Β· Page 1 of 1 (latest)
π Happy to help
Can you share the request ID (req_xxx) that throws this error? Hereβs how you can find it: https://support.stripe.com/questions/finding-the-id-for-an-api-request
Find help and support for Stripe. Our support center provides answers on all types of situations, including account information, charges and refunds, and subscriptions information. Get your questions answered and find international support for Stripe.
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
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']
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
Yup, so it'll be expand: ['line_items','subscription','payment_intent']
In any case if the object is present, it'll be expanded
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
what do you want to achieve?
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
That's awesome!!! Great to hear that everything works π€©
πͺ not bad for not a developer eh. Gonna have to stop saying that soon π