#atharva-unde_unexpected
1 messages ¡ Page 1 of 1 (latest)
đ Welcome to your new thread!
â˛ď¸ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
âąď¸ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
đ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1334745044980203562
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
hello! do you have an example subscription id where I can take a look? it'll have the prefix sub_
Hello @snow ocean
Does the subscription needs to be from the Stripe Account linked to my discord Id or any else will be just fine?
any will be fine
sub_1PqzIQBj3TGQUfAK1ShYnZTs
https://dashboard.stripe.com/events/evt_1QkT9lBj3TGQUfAKoL7BFS6o - I see the metadata in the invoice event under subscription_details
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
If you check you will see the metadata added upto invoice id in_1QD6NCBj3TGQUfAKq49VSVb8 as I had ran a script to update all past invoices in bulk
But the invoices generated later is missing out the metadata.
I was under assumption of it will be added automatically for new invoices (Considering its inherited from Subscription)
Eg: in_1QkSDNBj3TGQUfAKdIVM3Hye , in_1QZDRxBj3TGQUfAKhByon3kg, in_1QOL9PBj3TGQUfAKZY7xGtMV
sorry, but I don't understand. An invoice id has the prefix in_, i can see il_1QkSDNBj3TGQUfAKXEgiUq0N has that metadata too in the event i shared
Please give me a minute
let invoices = await stripe.invoices.list({
customer: `<Redacted>`,
});
invoices = invoices?.data?.length > 0 ? invoices?.data : [];
invoices?.forEach(async (inv) => {
console.log({
meta: inv?.metadata,
id: inv?.id,
});
});
Am trying to retrieve the data like this
And its returning data as
{ meta: {}, id: 'in_1QkSDNBj3TGQUfAKdIVM3Hye' }
{ meta: {}, id: 'in_1QZDRxBj3TGQUfAKhByon3kg' }
{ meta: {}, id: 'in_1QOL9PBj3TGQUfAKZY7xGtMV' }
{
meta: {
company: `<Redacted>`,
companyName: `<Redacted>`,
context: 'PURCHASE',
contract: 'MONTHLY',
email: `<Redacted>`,
time: '2024-10-25T11:12:57+05:30',
traceId: '547265eb-d0ef-4049-90ff-ef5b51d870e4'
},
id: 'in_1QD6NCBj3TGQUfAKq49VSVb8'
}
Hi @dusk lotus I'm taking over this thread
Thanks a lot!
Looks like you only set metadata on certain invioces.
Yup,
As I said, we ran the script to update the invoices and subscriptions when last 3 invoices were not generated, and thought that the new invoices will automatically inherit the metadata as its also attached to the subscription
No metadata isn't automatically inherited, you need to set it explicitly.
Is this the case as the initial subscription was created without metadata?
What if i create a new subscription with metadata?
Will it auto propagate to all upcoming invoices attached to that subscription?