#charan_code
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/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.
- charan_code, 4 days ago, 15 messages
- charan_code, 4 days ago, 13 messages
- charan_code, 5 days ago, 11 messages
??
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?
let me explain you from first?
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?
can i ?
Sure, please explain
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
???
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 includelatest_invoiceon the subscription
https://stripe.com/docs/expand
This invoice object will have a PDF url already
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
then how i need to get invoice through code?
What do you mean?
You get the latest_invoice via expansion, or you can retrieve it directly using the id, up to you
i need to get invoice url to send to my customrs?
Yes, so retrieve the latest_invoice from the subsription (either directly or via expansion) and then inspect the invoice_pdf attribute on that
invoice_pdf
Where are you looking for that?
const subscription = await stripe.subscriptions.retrieve(session.subscription, {
expand: ['latest_invoice'],
});
console.log('Subscription:', subscription);
in the response of subscription from above code
ok, if you're expanding that you should find it at subscription.latest_invoice.invoice_pdf
have revealed your test mode secret key, so you should roll that (and be careful to remove in future): https://stripe.com/docs/keys#rolling-keys
what might be the reason?
What does the latest invoice object look like when you do that? Can you share the subscription ID or invoice ID with me?
iam not getting ?
Please be much more specific. What are you not getting? You not getting a latest_invoice?
Please share the subscription ID in that case
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
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
heyy
thank you i have got invoice
really thank you so much
Great! happy to help