Is it possible to set localhost as the Stripe web link url?

I am creating a payment gateway using Stripe.

I want to set my localhost url localhost/stripe/webhook.php as my webhook url. Is it possible to set the local host address as the webhook url? This will be used to create a mail service that runs every successful build in Stripe.

+14
source share
7 answers

Check out http://www.ultrahook.com , which allows you to receive webcams on localhost

+25
source

How to use ngrok and configure Stripe Webhooks url

Source Link

  1. Download ngrok first and unzip it to your computer
  2. Double-click ngrok.exe
  3. Try typing ngrok.exe http 80 in this terminal to open port 80

  4. For example, if you have a Stripe webhooks URL on localhost, like this http: //localhost/stripeproject/webhook.php

  5. Just provide your ngrok url as the endpoint for your web service hooks, and you're almost done.

  6. You can configure this URL http://f253021b.ngrok.io/stripeproject/webhook.php to send the Webhooks test to your integration endpoint in your webhooks configuration accounts.

This works fine for me.

Click here for more details.

+23
source

No, that will not work. Stripe servers must be able to contact your server to send webhook. Stripe will not know how to contact your "localhost". To do this, you need a web-accessible address or an IP address.

+4
source

As Matt said, you will need to post it somewhere on the Internet - preferably with https: //. For your reference, I gave an example of webhook mail 2 months ago here: https://github.com/pnommensen/Stripe-Webhook-Emails .

+1
source

You can send webcams to the local host. Look at "ngrok" when you run this, it opens a port for public access to the Internet and provides you with a URL from which you can access your local host. take this url and set it as the web host address and complete the url by specifying it in the webhook.php file.

* EDIT *

This is for testing only.

+1
source

Now there is another option: now you can use the Stripe CLI for trouble-free local testing of web hooks without using a third-party tool.

In this case, you just have to do something like this to connect the Stripe events to your local web hook handler code:

 stripe listen --forward-to localhost/stripe/webhook.php 
+1
source

Even simpler: add this endpoint to your application when running locally (not in prod!):

 const eventsSeen = new Set(); app.post("/test/simulate-stripe-webhook", async (req, res) => { const events = await stripe.events.list({ limit: req.query.limit || 10 }); for (const event of events) { if (eventsSeen.has(event.id)) continue; await processStripeEvent(event); eventsSeen.add(event.id); } return res.status(200).end(); }); 

... where processStripeEvent is any logic that your web hook fires.

Then there is no need to manage strip web leads.

0
source

All Articles