#charan_code

1 messages ยท Page 1 of 1 (latest)

keen sirenBOT
#

๐Ÿ‘‹ 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/1328747083561173074

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.

pulsar hedge
#

??

wooden oracle
#

iam correctly passing session id from frontend and iam even getting invoice hosted url in stripe webhook

#

I don't understand what you're describing here. How are hosted invoice URLs relevant to this checkout session context?

#

when i try to generate invoice by passing session id from frontend
what exactly are you trying to do here? This isn't something that I expect to work. Are you following a guide that suggests you can do this?

pulsar hedge
#

let me explain you from first?

wooden oracle
#

Can you share the exact request ID that gets an error so I can review the parameters you're sending and the error your encounter?

pulsar hedge
#

can i ?

wooden oracle
#

Sure, please explain

pulsar hedge
#

yeah thank you

#

actually i have products to subscribe
so i have created stripe checkout session and then got hosted url to pay certain amount then after successful payment i need to generate invoice for payment

#

could you please guide me for that

#

???

wooden oracle
#

then after successful payment i need to generate invoice for payment
If you're creating subscriptions, the invoice is already generated for you, there is no need to create it, and in fact you cannot do so after the fact

#

You can retrieve the subscription from the sesison, and the latest_invoice and get the pdf URL

#

Why are you creating invoices after creating subscriptions via Checkout?

#

const subscription = await stripe.subscriptions.retrieve(session.subscription);
here, you can use expansion to include latest_invoice on the subscription
https://stripe.com/docs/expand
This invoice object will have a PDF url already

pulsar hedge
#

then how i need to get invoice through code?

wooden oracle
#

What do you mean?

#

You get the latest_invoice via expansion, or you can retrieve it directly using the id, up to you

pulsar hedge
#

i need to get invoice url to send to my customrs?

wooden oracle
#

Yes, so retrieve the latest_invoice from the subsription (either directly or via expansion) and then inspect the invoice_pdf attribute on that

pulsar hedge
#

ok will try

#

no iam not able to find that attribute

wooden oracle
#

Which attribute?

#

And where are you looking?

pulsar hedge
#

invoice_pdf

wooden oracle
#

Where are you looking for that?

pulsar hedge
#

const subscription = await stripe.subscriptions.retrieve(session.subscription, {
expand: ['latest_invoice'],
});
console.log('Subscription:', subscription);
in the response of subscription from above code

wooden oracle
#

ok, if you're expanding that you should find it at subscription.latest_invoice.invoice_pdf

pulsar hedge
#

please review my code

#

iam not getting any invoice url

wooden oracle
pulsar hedge
#

what might be the reason?

wooden oracle
#

What does the latest invoice object look like when you do that? Can you share the subscription ID or invoice ID with me?

pulsar hedge
#

iam not getting ?

wooden oracle
#

Please be much more specific. What are you not getting? You not getting a latest_invoice?

#

Please share the subscription ID in that case

pulsar hedge
#

sub_1QhBcHSHnZYTSMbTOsB7YIAq

#

check it above

wooden oracle
#

Yep, looks like an active subscription, the latest invoice is currentl in_1QhCF4SHnZYTSMbTIBbb0jgz

#

Can you share your retrieval request with the expansion?

#

If the expansion is not working, the subscription latest_invoice should still give you that invoice id

pulsar hedge
#

heyy
thank you i have got invoice
really thank you so much

wooden oracle
#

Great! happy to help