#Yerin-webhook

1 messages · Page 1 of 1 (latest)

jade palm
#

Hello, unfortunately we don't quite familiar with Firebase. It might be faster if you reach out to Firebase team. Is there an error related to Stripe API?

#

What do you mean by hosting through firebase but listen to webhook locally?

timid island
#

I am using firebase to host my website. When using Gatsby development mode, my code works fine in test mode. When I switched to host my website through firebase, it should read webhooks from my functions file but when I test my code it doesn't seem to be working as before.I'll contact firebase but a question then I have is that if i deploy my website to the web, is it then impossible to test with test keys?

#

It must only be done through local environments

jade palm
#

There is no restriction like that. You should be able to use your Test key with any environment, local or on the web

#

Test key and Live key only to differentiate between Stripe's Test Mode and Live Mode, separated on your Stripe account. It doesn't matter to where you host your application

timid island
#

Perfect

#

Thank you

timid island
#

I have a follow up question if you're available

jade palm
#

Yes!

timid island
#

I am trying to use stripe cli to listen to events

#

When I used netlify, i could simply use the following command stripe listen --forward-to localhost:8888/.netlify/functions/handle-purchase as my file to listen to webhooks was functions -> handle-purchase

#

I am using firebase but my path is the same but using a different name (index.js instead of handle-purchase)

#

so the command i am using now is stripe listen --forward-to localhost:5001/functions/index

#
│ Emulator       │ Host:Port      │ View in Emulator UI             │
├────────────────┼────────────────┼─────────────────────────────────┤
│ Authentication │ localhost:9099 │ http://localhost:4000/auth      │
├────────────────┼────────────────┼─────────────────────────────────┤
│ Functions      │ localhost:5001 │ http://localhost:4000/functions │
├────────────────┼────────────────┼─────────────────────────────────┤
│ Firestore      │ localhost:8080 │ http://localhost:4000/firestore │
├────────────────┼────────────────┼─────────────────────────────────┤
│ Hosting        │ localhost:5000 │ n/a                             │
├────────────────┼────────────────┼─────────────────────────────────┤
│ Storage        │ localhost:9199 │ http://localhost:4000/storage   │
└────────────────┴────────────────┴─────────────────────────────────┘
``` are the following ports I am given
#

When I execute stripe trigger payment_intent.created, I can see the api call in stripe logs tail but

#

when I listen using the port mentioned above, i get the following...

#
2021-11-24 03:24:16   --> payment_intent.created [evt_3JzHiADtAqr0NEuG24XUtbFU]
2021-11-24 03:24:16  <--  [404] POST http://localhost:5001 [evt_3JzHiADtAqr0NEuG24XUtbFU]
solar plover
#

hmm. are you sure you're calling stripe listen the way you say you are?

#

I'd think you can only get that error if you are actually calling stripe listen --forward-to localhost:5001 instead

timid island
#

Yeah, when I use gatsby and netlify, everything worked smoothly

#

but I had to switch to firebase functions and the same code doesn't work now

#

I have been trying to make this work for 2 days now and I can't seem to get it.. 😦

solar plover
#

unfortunately I know very little about Firebase (or Netlify/Gatsby for that matter)

solid hemlock
#

@timid island Did you make any progress with this?

#

Is that the Firebase CLI?