#mathias_webhooks

1 messages ยท Page 1 of 1 (latest)

spiral timberBOT
#

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

glad jasper
mental garden
#

Hi Alex. Thanks for swift replay, I'll give it a shot!

mental garden
#

When trying out your solution I get the following error: No such invoice: 'in_1PHKbgHHlF65TJNq94RkFeBF'

glad jasper
mental garden
#

req_hxyGgdouQP3cyr

glad jasper
#

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

mental garden
#

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.

glad jasper
#

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?

mental garden
#

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?

glad jasper
#

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

Learn how to use webhooks with Connect to be notified of Stripe activity.

#

I'm not sure where you've setup your webhook endpoint that is listening for invoice.created events

mental garden
#

Right now I'm developing it locally and listen with this command: stripe listen --forward-connect-to localhost:6060/api/stripe/webhook/connect

glad jasper
mental garden
#

Can I just paste what I receive in the webhook here, or is it unsafe?

#

I dont see an account attribute in it.

glad jasper
#

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)

mental garden
glad jasper
#

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": {
....
mental garden
#

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.