#MarkoBoras
1 messages · Page 1 of 1 (latest)
Hi there!
There are no specific events for the customer portal. If you want to know when a payment happen, then probably payment_intent.succeeded.
Hmm I have this logic in app
First time subscriptions are handled through stripe checkout
Upgrade of subscription is handled through customer portal
How can I listen in webhooks and differentiate those 2 events
I need to send different mails to user on email
I am handling upgrade of subscription through customer portal because I had issues for recurring payments through stripe checkout
You would get different events:
- When the Checkout is completed:
checkout.session.completed - When a Subscription is updated (for example, with the customer portal):
customer.subscription.udpated
Thank you.
How to configure existing webhook to listen to more events
found it
nothing
tyy
Happy to help 🙂
One more question please
I am using firebase as a backend
How can I construct event in my webhook function and check for different types of events
let event;
try {
event = stripe.webhooks.constructEvent(request.body, sig, endpointSecret);
} catch (err) {
response.status(400).send(Webhook Error: ${err.message});
return;
}
or better question
how to get endpointSecret
I am continuing work of someone else and that's why I am asking all this
How can I construct event in my webhook function and check for different types of events
I recommend reading this: https://stripe.com/docs/webhooks/quickstart
how to get endpointSecret
It's available in your dashboard when looking at a specific webhook endpoint https://dashboard.stripe.com/test/webhooks
thankss
how to get event type in firebase http function
I tried to get
const sig = request.headers['stripe-signature'] as
| string
| string[]
| Buffer;
const event = stripe.webhooks.constructEvent(
request.body,
sig,
endpointSecret,
);
but in log error I get. No signatures found matching the expected signature for payload.
Check our firebase sample function:
https://github.com/stripe/stripe-firebase-extensions/blob/next/firestore-stripe-payments/functions/src/index.ts#L676
tyy