#MarkoBoras

1 messages · Page 1 of 1 (latest)

vital mistBOT
ocean kettle
#

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.

limpid pendant
#

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

ocean kettle
#

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
limpid pendant
#

Thank you.

#

How to configure existing webhook to listen to more events

#

found it

#

nothing

#

tyy

ocean kettle
#

Happy to help 🙂

limpid pendant
#

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

ocean kettle
limpid pendant
#

thankss

limpid pendant
#

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.

limpid pendant
#

tyy