#mathias_webhooks
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/1240912420030124103
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
hello! Invoices are not automatically generated for one-off payments. If you need them and are using Checkout Sessions, you can set this parameter to true : https://docs.stripe.com/api/checkout/sessions/create#create_checkout_session-invoice_creation-enabled
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Hi Alex. Thanks for swift replay, I'll give it a shot!
When trying out your solution I get the following error: No such invoice: 'in_1PHKbgHHlF65TJNq94RkFeBF'
Can you share the request id [0]? it'd look like req_xxx
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
req_hxyGgdouQP3cyr
i assume you're creating a direct charge with the Checkout Session. If that's the case, you should be using the StripeAccount header to retrieve the Invoice from the connected account
Of course, thats the problem. I don't receive the connected account id in the invoice data, so what would be the best way to fix that? I do send it when creating a new session in the payment_intent_data object. But its not visible in the invoice.
are you not currently saving the data about which connected account the order / Checkout Session is for?
how are you retrieving the Invoice data? i.e. how do you know what's the Invoice id to retrieve? Are you listening for an event?
I listen for the webhook invoice.created to know when to update my local database about the purchase. When receiving the webhook I call stripe (stripe.invoices.retrieve) with the id I have just received in the webhook. But here I need to append the connected account id, but thats not present in the webhook (invoice.created).
So I guess I need to send some other meta information along with the session.create?
i don't see any webhook endpoints setup on your platform account. You would actually want to setup Connect webhooks : https://docs.stripe.com/connect/webhooks. The webhook event from a connected account will contain the connected account id
I'm not sure where you've setup your webhook endpoint that is listening for invoice.created events
Right now I'm developing it locally and listen with this command: stripe listen --forward-connect-to localhost:6060/api/stripe/webhook/connect
you should be able to see https://docs.stripe.com/api/events/object#event_object-account
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Can I just paste what I receive in the webhook here, or is it unsafe?
I dont see an account attribute in it.
hrm, feel free to paste it. Since it's a test event, i'm assuming you don't have any sensitive info inside, e.g. real customer names, emails, addresses etc. If you do, you should redact those. The object id itself isn't sensitive info. The general public can't do anything with an object id unless they have access to your Stripe account (and/or API keys)
that's just the data.object : https://docs.stripe.com/api/events/object#event_object-data-object
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
for example if you see the event object example in our specs
{
"id": "evt_1NG8Du2eZvKYlo2CUI79vXWy",
"object": "event",
"api_version": "2019-02-19",
"created": 1686089970,
"data": {
"object": {
....
Ahh you're right. I get it now ๐ I was passing event.data.object to my method, but needed to look at the event itself.