#atharva-unde_unexpected

1 messages ¡ Page 1 of 1 (latest)

lean canopyBOT
#

👋 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.

snow ocean
#

hello! do you have an example subscription id where I can take a look? it'll have the prefix sub_

dusk lotus
#

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?

snow ocean
#

any will be fine

dusk lotus
#

sub_1PqzIQBj3TGQUfAK1ShYnZTs

snow ocean
dusk lotus
#

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

snow ocean
#

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

dusk lotus
#

Please give me a minute

lean canopyBOT
dusk lotus
#
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'
}

ivory parcel
#

Hi @dusk lotus I'm taking over this thread

dusk lotus
#

Thanks a lot!

ivory parcel
#

Looks like you only set metadata on certain invioces.

dusk lotus
#

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

ivory parcel
#

No metadata isn't automatically inherited, you need to set it explicitly.

dusk lotus