Hano
Hano

Reputation: 21

Nodejs Stripe Webhooks

I am trying to create a stripe webhook for sending a notification to user email (not customer) every time a customer adds credit card to his account. Talked with stripe support team but, the only information they gave me was too implement it through stripe webhooks.

Stripe has some notification that we can enable and that will send notifications to user email but, it does not have a notification for when customer adds credit card details to his account and I am trying to implement that. Thanks in advance

I've already installed ngrok to run the webhook but, I do not know how to set up enpoint and create the webhook to send notifications to user

Upvotes: 0

Views: 1705

Answers (3)

Tien Nguyen
Tien Nguyen

Reputation: 29

You can sign in stripe, Navigation to Webhooks in left dashboard. And then create a webhook endpoint with ngrok host and your webhook API route. Example, you create an webhook endpoint API like POST /api/v1/webhooks/stripe => Your webhook endpoint is: https://ngrok.abc/api/v1/webhooks/stripe Click here to redirect to stripe webhooks page

Upvotes: 1

pravin
pravin

Reputation: 1

Will a Slack notification work for you? Here’s an automation I created using Pipedream’s free service that listens for Stripe's customer.source.created event (based on @Paul Asjes suggestion) and sends a message to Slack:

https://pipedream.com/@pravin/send-message-to-slack-when-payment-method-added-in-stripe-p_7NClk5

To use it:

  1. Fork the template
  2. Create an incoming webhook URL in Slack and add it to the Pipedream workflow
  3. Copy the Pipedream endpoint and set it as the webhook URL for customer.source.created events in Stripe

I hope that's helpful! I confirmed that it works with a test event from Stripe. If the notification has to an email, do you use any email services like Sendgrid?

Upvotes: 0

Paul Asjes
Paul Asjes

Reputation: 5847

I'm not sure what you mean by "sending a notification to user email (not customer)" but Stripe generally won't send emails to your users.

You'd have to implement sending an email on card update yourself. Have a look at implementing webhooks (https://stripe.com/docs/webhooks/setup) and then listening for the customer.source.created event (https://stripe.com/docs/api/events/types#event_types-customer.source.created).

Upvotes: 0

Related Questions