Webhooks on localhost

11.5k Views Asked by At

I am creating a payment gateway using Paymill (which is comparable to Stripe). I want my website to automatically react to subscription-based billings. This is why I am considering Paymill webhooks.

I am in the testing phase and thus on localhost (XAMPP). The receiving webhook script would therefore have this URL:

localhost/paymill-example-php-subscriptions-master/src/Paymill/LlamaKisses/Controllers/WebhooksController.php. 

But is it possible at all to set a localhost address as a webhook url (and how)?

(By the way, isn't WebhooksController.php missing a response code line like this:

http_response_code(200);

to let the sending webhook know it succeeded and needn't retry?)

Many thanks in advance!

3

There are 3 best solutions below

0
On

You can use Webhook Relay (https://webhookrelay.com) to create webhook forwarding tunnels or bidirectional tunnels:

$ relay forward -b webhook-demo http://localhost:8090/webhook
Forwarding:
https://my.webhookrelay.com/v1/webhooks/5e722a5e-f3d2-4hqec-9e9f-79f1158e4b10 -> http://localhost:8090/webhook
starting webhook relay agent..

Endpoints are permanent (until you delete them) and it is also possible to fan-out webhooks to more than one destination. .

1
On
0
On

I am using Azure Websites with a Free mode website. With that you can attach remote debugger to the Azure Website and if I am not mistaken you can do that with free tools from MS too. You can easily switch on tracing to Azure Table storage or file system and from within a webbrowser or tools look at logs. It may not be apt for you, but if you have a bit of time to play around it's quite easy. I am logging the whole PayMill webhook message to an Azure Table .